Class XRUIInputModule
Custom class for input modules that send UI input in XR.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.UI
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[AddComponentMenu("Event/XR UI Input Module", 11)]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.5/api/UnityEngine.XR.Interaction.Toolkit.UI.XRUIInputModule.html")]
public class XRUIInputModule : UIInputModule
Properties
cancelAction
The Input System action to use for cancelling or backing out of a UI element. Must be a ButtonControl Control.
Declaration
public InputActionReference cancelAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
cancelButton
Name of the gamepad/joystick button to use for UI cancel or back commands when using the old Input Manager.
Declaration
public string cancelButton { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
enableBuiltinActionsAsFallback
When enabled, built-in Input System actions will be used if no Input System UI Actions are assigned. This uses the currently enabled Input System devices: current, current, current, and current.
Declaration
public bool enableBuiltinActionsAsFallback { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
enableGamepadInput
If true, will forward gamepad data to UI elements. Ignored when any Input System UI Actions are used.
Declaration
public bool enableGamepadInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
enableJoystickInput
If true, will forward joystick data to UI elements. Ignored when any Input System UI Actions are used.
Declaration
public bool enableJoystickInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
enableMouseInput
If true, will forward 2D mouse data to UI elements. Ignored when any Input System UI Actions are used.
Declaration
public bool enableMouseInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
enableTouchInput
If true, will forward 2D touch data to UI elements. Ignored when any Input System UI Actions are used.
Declaration
public bool enableTouchInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
enableXRInput
If true, will forward 3D tracked device data to UI elements.
Declaration
public bool enableXRInput { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
horizontalAxis
Name of the horizontal axis for UI navigation when using the old Input Manager.
Declaration
public string horizontalAxis { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
leftClickAction
The Input System action to use to determine whether the left button of a pointer is pressed. Must be a ButtonControl Control.
Declaration
public InputActionReference leftClickAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
middleClickAction
The Input System action to use to determine whether the middle button of a pointer is pressed. Must be a ButtonControl Control.
Declaration
public InputActionReference middleClickAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
navigateAction
The Input System action to use to navigate the currently active UI. Must be a Vector2Control Control.
Declaration
public InputActionReference navigateAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
pointAction
The Input System action to use to move the pointer on the currently active UI. Must be a Vector2Control Control.
Declaration
public InputActionReference pointAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
rightClickAction
The Input System action to use to determine whether the right button of a pointer is pressed. Must be a ButtonControl Control.
Declaration
public InputActionReference rightClickAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
scrollWheelAction
The Input System action to use to move the pointer on the currently active UI. Must be a Vector2Control Control.
Declaration
public InputActionReference scrollWheelAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
submitAction
The Input System action to use for submitting or activating a UI element. Must be a ButtonControl Control.
Declaration
public InputActionReference submitAction { get; set; }
Property Value
| Type | Description |
|---|---|
| InputActionReference |
submitButton
Name of the gamepad/joystick button to use for UI selection or submission when using the old Input Manager.
Declaration
public string submitButton { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
verticalAxis
Name of the vertical axis for UI navigation when using the old Input Manager.
Declaration
public string verticalAxis { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Methods
Awake()
See MonoBehavior.Awake.
Declaration
protected override void Awake()
Overrides
DoProcess()
Process the current tick for the module.
Declaration
protected override void DoProcess()
Overrides
Remarks
Executed once per Update call. Override for custom processing.
See Also
GetInteractor(int)
Gets an IUIInteractor from its corresponding Unity UI Pointer Id. This can be used to identify individual Interactors from the underlying UI Events.
Declaration
public IUIInteractor GetInteractor(int pointerId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pointerId | A unique integer representing an object that can point at UI. |
Returns
| Type | Description |
|---|---|
| IUIInteractor | Returns the interactor associated with |
GetRegisteredInteractors(List<IUIInteractor>)
Returns all registered Interactors into List results.
Declaration
public void GetRegisteredInteractors(List<IUIInteractor> results)
Parameters
| Type | Name | Description |
|---|---|---|
| List<IUIInteractor> | results | List to receive registered Interactors. |
Remarks
This method populates the list with the registered Interactors at the time the
method is called. It is not a live view, meaning Interactors
registered or unregistered afterward will not be reflected in the
results of this method.
Clears results before adding to it.
See Also
GetTrackedDeviceModel(IUIInteractor, out TrackedDeviceModel)
Retrieves the UI Model for a selected IUIInteractor.
Declaration
public bool GetTrackedDeviceModel(IUIInteractor interactor, out TrackedDeviceModel model)
Parameters
| Type | Name | Description |
|---|---|---|
| IUIInteractor | interactor | The IUIInteractor you want the model for. |
| TrackedDeviceModel | model | The returned model that reflects the UI state of the |
Returns
| Type | Description |
|---|---|
| bool | Returns true if the model was retrieved. Otherwise, returns false. |
OnDestroy()
Declaration
protected override void OnDestroy()
Overrides
OnDisable()
Declaration
protected override void OnDisable()
Overrides
OnEnable()
Declaration
protected override void OnEnable()
Overrides
OnRegistered(UIInteractorRegisteredEventArgs)
Automatically called when an IUIInteractor is registered with this component.
Notifies the UI interactor, passing the given args.
Declaration
protected virtual void OnRegistered(UIInteractorRegisteredEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| UIInteractorRegisteredEventArgs | args | Event data containing the registered UI interactor. |
Remarks
args is only valid during this method call, do not hold a reference to it.
See Also
OnUnregistered(UIInteractorUnregisteredEventArgs)
Automatically called when an IUIInteractor is unregistered from this component.
Notifies the UI interactor, passing the given args.
Declaration
protected virtual void OnUnregistered(UIInteractorUnregisteredEventArgs args)
Parameters
| Type | Name | Description |
|---|---|---|
| UIInteractorUnregisteredEventArgs | args | Event data containing the unregistered UI interactor. |
Remarks
args is only valid during this method call, do not hold a reference to it.
See Also
RegisterInteractor(IUIInteractor)
Register an IUIInteractor with the UI system. Calling this will enable it to start interacting with UI.
Declaration
public void RegisterInteractor(IUIInteractor interactor)
Parameters
| Type | Name | Description |
|---|---|---|
| IUIInteractor | interactor | The IUIInteractor to use. |
RegisterWaitlistInteractors()
Register all waitlist interactors, which were registered UI interactors to another XR UI Input Module when that other input module component was destroyed, or UI enabled interactors when project settings disallow automatic registration.
Declaration
public void RegisterWaitlistInteractors()
RegisterWithWaitlist(IUIInteractor)
Registers a new Interactor to a waitlist to be processed by the XR UI Input Module component once a default XR UI Input Module is available. This can be used to register the component argument to an XR UI Input Module when it does not have a reference to a particular XR UI Input Module.
Declaration
public static void RegisterWithWaitlist(IUIInteractor interactor)
Parameters
| Type | Name | Description |
|---|---|---|
| IUIInteractor | interactor | The Interactor to be registered to the waitlist. |
See Also
UnregisterFromWaitList(IUIInteractor)
Remove the Interactor from the waitlist so that it will no longer be automatically registered with the default XR UI Input Module.
Declaration
public static void UnregisterFromWaitList(IUIInteractor interactor)
Parameters
| Type | Name | Description |
|---|---|---|
| IUIInteractor | interactor | The Interactor to be unregistered from the waitlist. |
See Also
UnregisterInteractor(IUIInteractor)
Unregisters an IUIInteractor with the UI system. This cancels all UI Interaction and makes the IUIInteractor no longer able to affect UI.
Declaration
public void UnregisterInteractor(IUIInteractor interactor)
Parameters
| Type | Name | Description |
|---|---|---|
| IUIInteractor | interactor | The IUIInteractor to stop using. |
Events
interactorRegistered
Calls the methods in its invocation list when an IUIInteractor is registered.
Declaration
public event Action<UIInteractorRegisteredEventArgs> interactorRegistered
Event Type
| Type | Description |
|---|---|
| Action<UIInteractorRegisteredEventArgs> |
Remarks
The UIInteractorRegisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
interactorUnregistered
Calls the methods in its invocation list when an IUIInteractor is unregistered.
Declaration
public event Action<UIInteractorUnregisteredEventArgs> interactorUnregistered
Event Type
| Type | Description |
|---|---|
| Action<UIInteractorUnregisteredEventArgs> |
Remarks
The UIInteractorUnregisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.