docs.unity3d.com
    Show / Hide Table of Contents

    Class UIInputModule

    Base class for input modules that send UI input.

    Inheritance
    Object
    UIInputModule
    XRUIInputModule
    Namespace: UnityEngine.XR.Interaction.Toolkit.UI
    Syntax
    public abstract class UIInputModule : BaseInputModule
    Remarks

    Multiple input modules may be placed on the same event system. In such a setup, the modules will synchronize with each other.

    Properties

    clickSpeed

    The maximum time (in seconds) between two mouse presses for it to be consecutive click.

    Declaration
    public float clickSpeed { get; set; }
    Property Value
    Type Description
    Single

    moveDeadzone

    The absolute value required by a move action on either axis required to trigger a move event.

    Declaration
    public float moveDeadzone { get; set; }
    Property Value
    Type Description
    Single

    repeatDelay

    The Initial delay (in seconds) between an initial move action and a repeated move action.

    Declaration
    public float repeatDelay { get; set; }
    Property Value
    Type Description
    Single

    repeatRate

    The speed (in seconds) that the move action repeats itself once repeating.

    Declaration
    public float repeatRate { get; set; }
    Property Value
    Type Description
    Single

    trackedDeviceDragThresholdMultiplier

    Scales the , for tracked devices, to make selection easier.

    Declaration
    public float trackedDeviceDragThresholdMultiplier { get; set; }
    Property Value
    Type Description
    Single

    uiCamera

    The that is used to perform 2D raycasts when determining the screen space location of a tracked device cursor.

    Declaration
    public Camera uiCamera { get; set; }
    Property Value
    Type Description
    Camera

    Methods

    DoProcess()

    Process the current tick for the module.

    Declaration
    protected virtual void DoProcess()
    Remarks

    Executed once per Update call. Override for custom processing.

    See Also
    Process()

    Process()

    Declaration
    public override void Process()

    SendUpdateEventToSelectedObject()

    Sends an update event to the currently selected object.

    Declaration
    protected bool SendUpdateEventToSelectedObject()
    Returns
    Type Description
    Boolean

    Returns whether the update event was used by the selected object.

    Update()

    See .

    Declaration
    protected virtual void Update()
    Remarks

    Processing is postponed from earlier in the frame ( has a script execution order of -1000) until this Update to allow other systems to update the poses that will be used to generate the raycasts used by this input module.
    For Ray Interactor, it must wait until after the Controller pose updates and Locomotion moves the Rig in order to generate the current sample points used to create the rays used for this frame. Those positions will be determined during DoProcess(). Ray Interactor needs the UI raycasts to be completed by the time XRInteractionManager calls into GetValidTargets(List<XRBaseInteractable>) since that is dependent on whether a UI hit was closer than a 3D hit. This processing must therefore be done between Locomotion and ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase) to minimize latency.

    Events

    beginDrag

    This occurs when a drag first occurs on an element.

    Declaration
    public event Action<GameObject, PointerEventData> beginDrag
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    cancel

    This occurs when the cancel button is pressed.

    Declaration
    public event Action<GameObject, BaseEventData> cancel
    Event Type
    Type Description
    Action<GameObject, BaseEventData>

    drag

    This occurs every frame while dragging an element.

    Declaration
    public event Action<GameObject, PointerEventData> drag
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    drop

    This occurs when a dragged element is dropped on a drop handler.

    Declaration
    public event Action<GameObject, PointerEventData> drop
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    endDrag

    This occurs on the last frame an element is dragged.

    Declaration
    public event Action<GameObject, PointerEventData> endDrag
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    finalizeRaycastResults

    Calls the methods in its invocation list after the input module collects a list of type , but before the results are used. Note that not all fields of the event data are still valid or up to date at this point in the UI event processing. This event can be used to read, modify, or reorder results. After the event, the first result in the list with a non-null GameObject will be used.

    Declaration
    public event Action<PointerEventData, List<RaycastResult>> finalizeRaycastResults
    Event Type
    Type Description
    Action<PointerEventData, List<RaycastResult>>

    initializePotentialDrag

    This occurs when a potential drag occurs on an element.

    Declaration
    public event Action<GameObject, PointerEventData> initializePotentialDrag
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    move

    This occurs when the move axis is activated.

    Declaration
    public event Action<GameObject, AxisEventData> move
    Event Type
    Type Description
    Action<GameObject, AxisEventData>

    pointerClick

    This occurs when a select button click occurs while a UI pointer is hovering an element.

    Declaration
    public event Action<GameObject, PointerEventData> pointerClick
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    pointerDown

    This occurs when a select button down occurs while a UI pointer is hovering an element. This event is executed using ExecuteEvents.ExecuteHierarchy when sent to the target element.

    Declaration
    public event Action<GameObject, PointerEventData> pointerDown
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    pointerEnter

    This occurs when a UI pointer enters an element.

    Declaration
    public event Action<GameObject, PointerEventData> pointerEnter
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    pointerExit

    This occurs when a UI pointer exits an element.

    Declaration
    public event Action<GameObject, PointerEventData> pointerExit
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    pointerUp

    This occurs when a select button up occurs while a UI pointer is hovering an element.

    Declaration
    public event Action<GameObject, PointerEventData> pointerUp
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    scroll

    This occurs when an element is scrolled This event is executed using ExecuteEvents.ExecuteHierarchy when sent to the target element.

    Declaration
    public event Action<GameObject, PointerEventData> scroll
    Event Type
    Type Description
    Action<GameObject, PointerEventData>

    submit

    This occurs when the submit button is pressed.

    Declaration
    public event Action<GameObject, BaseEventData> submit
    Event Type
    Type Description
    Action<GameObject, BaseEventData>

    updateSelected

    This occurs on update for the currently selected object.

    Declaration
    public event Action<GameObject, BaseEventData> updateSelected
    Event Type
    Type Description
    Action<GameObject, BaseEventData>
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023