Language
Edit

UGUIInputAdapter Class

Definition

An input adapter that translates UnityUI input events into XRI-compatible interactions.

[UnityEngine.AddComponentMenu("MRTK/UX/UGUI Input Adapter")]
public class UGUIInputAdapter : UnityEngine.UI.Selectable, UnityEngine.EventSystems.ISubmitHandler
[<UnityEngine.AddComponentMenu("MRTK/UX/UGUI Input Adapter")>]
type UGUIInputAdapter = class
    inherit Selectable
    interface ISubmitHandler
    interface IEventSystemHandler
Public Class UGUIInputAdapter
Inherits Selectable
Implements ISubmitHandler
Inheritance
UnityEngine.UI.Selectable
UGUIInputAdapter
Derived
Attributes
UnityEngine.AddComponentMenuAttribute
Implements
UnityEngine.EventSystems.IEventSystemHandler UnityEngine.EventSystems.ISubmitHandler

Constructors

Name Description
UGUIInputAdapter()

Properties

Name Description
InteractionManager

The interaction manager to use to query interactors and their registration events. Currently protected internal, may be exposed in a future update.

MovableAxes

Which axes should be used for manipulation instead of navigation? For sliders, this should match the slider axis.

OnMoveDelta

For the movable axes, what distance should be moved on each OnMove event?

ProxyInteractor

The associated UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable on behalf of which this shim will translate input events.

ThisInteractable

The associated UnityEngine.XR.Interaction.Toolkit.XRBaseInteractable on behalf of which this adapter will translate input events.

Methods

Name Description
Awake()

A Unity event function that is called when an enabled script instance is being loaded.

Click()

Click the interactable. This will result in the interactable being selected and then deselected after a short period of time. This is the same behavior that occurs when this adapter receives a Unity UGUI OnSubmit(BaseEventData) event.

IsXRUIEvent(PointerEventData)

Test if the given event data corresponds to a Unity XRI interactor.

Move(Vector3)

OnMoves on UnityUI elements are equivalent to selecting, moving, and deselecting with XRI. This coroutine has a single-frame delay between these actions to ensure XRI synchronizes and recognizes these inputs. The object-local delta is scaled by the OnMoveDelta value.

OnDeselect(BaseEventData)

Unset selection and transition to appropriate state.

OnDisable()

A Unity event function that is called when the script component has been disabled.

OnInteractorRegistered(InteractorRegisteredEventArgs)

Called when a an UnityEngine.XR.Interaction.Toolkit.IXRInteractor is registered with a Unity UnityEngine.XR.Interaction.Toolkit.XRInteractionManager.

OnInteractorUnregistered(InteractorUnregisteredEventArgs)

Called when a an UnityEngine.XR.Interaction.Toolkit.IXRInteractor is unregistered with a Unity UnityEngine.XR.Interaction.Toolkit.XRInteractionManager.

OnMove(AxisEventData)

Determine in which of the 4 move directions the next selectable object should be found.

OnPointerDown(PointerEventData)

Evaluate current state and transition to pressed state.

OnPointerEnter(PointerEventData)

Evaluate current state and transition to appropriate state. New state could be pressed or hover depending on pressed state.

OnPointerExit(PointerEventData)

Evaluate current state and transition to normal state.

OnPointerUp(PointerEventData)

Evaluate eventData and transition to appropriate state.

OnSelect(BaseEventData)

Set selection and transition to appropriate state.

OnSubmit(BaseEventData)

Called when the Unity UGUI element is selected.

OnValidate()

A Unity Editor only event function that is called when the script is loaded or a value changes in the Unity Inspector.

Applies to