docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRBaseInputInteractor

    Abstract base class from which all interactors that use inputs to drive interaction state derive from.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseInteractor
    XRBaseInputInteractor
    NearFarInteractor
    XRDirectInteractor
    XRRayInteractor
    Implements
    IXRHoverInteractor
    IXRSelectInteractor
    IXRTargetPriorityInteractor
    IXRGroupMember
    IXRInteractionStrengthInteractor
    IXRActivateInteractor
    IXRInteractor
    Inherited Members
    XRBaseInteractor.registered
    XRBaseInteractor.unregistered
    XRBaseInteractor.interactionManager
    XRBaseInteractor.containingGroup
    XRBaseInteractor.interactionLayers
    XRBaseInteractor.handedness
    XRBaseInteractor.attachTransform
    XRBaseInteractor.keepSelectedTargetValid
    XRBaseInteractor.disableVisualsWhenBlockedInGroup
    XRBaseInteractor.startingSelectedInteractable
    XRBaseInteractor.startingTargetFilter
    XRBaseInteractor.hoverEntered
    XRBaseInteractor.hoverExited
    XRBaseInteractor.selectEntered
    XRBaseInteractor.selectExited
    XRBaseInteractor.targetFilter
    XRBaseInteractor.allowHover
    XRBaseInteractor.allowSelect
    XRBaseInteractor.isPerformingManualInteraction
    XRBaseInteractor.interactablesHovered
    XRBaseInteractor.hasHover
    XRBaseInteractor.interactablesSelected
    XRBaseInteractor.firstInteractableSelected
    XRBaseInteractor.hasSelection
    XRBaseInteractor.startingHoverFilters
    XRBaseInteractor.hoverFilters
    XRBaseInteractor.startingSelectFilters
    XRBaseInteractor.selectFilters
    XRBaseInteractor.largestInteractionStrength
    XRBaseInteractor.Reset()
    XRBaseInteractor.Start()
    XRBaseInteractor.OnDestroy()
    XRBaseInteractor.GetAttachTransform(IXRInteractable)
    XRBaseInteractor.GetAttachPoseOnSelect(IXRSelectInteractable)
    XRBaseInteractor.GetLocalAttachPoseOnSelect(IXRSelectInteractable)
    XRBaseInteractor.GetValidTargets(List<IXRInteractable>)
    XRBaseInteractor.isHoverActive
    XRBaseInteractor.targetsForSelection
    XRBaseInteractor.CanHover(IXRHoverInteractable)
    XRBaseInteractor.CanSelect(IXRSelectInteractable)
    XRBaseInteractor.IsHovering(IXRHoverInteractable)
    XRBaseInteractor.IsSelecting(IXRSelectInteractable)
    XRBaseInteractor.IsHovering(IXRInteractable)
    XRBaseInteractor.IsSelecting(IXRInteractable)
    XRBaseInteractor.selectedInteractableMovementTypeOverride
    XRBaseInteractor.CaptureAttachPose(IXRSelectInteractable)
    XRBaseInteractor.CreateAttachTransform()
    XRBaseInteractor.GetInteractionStrength(IXRInteractable)
    XRBaseInteractor.OnRegistered(InteractorRegisteredEventArgs)
    XRBaseInteractor.OnUnregistered(InteractorUnregisteredEventArgs)
    XRBaseInteractor.OnHoverEntered(HoverEnterEventArgs)
    XRBaseInteractor.OnHoverExited(HoverExitEventArgs)
    XRBaseInteractor.OnSelectEntered(SelectEnterEventArgs)
    XRBaseInteractor.OnSelectExited(SelectExitEventArgs)
    XRBaseInteractor.ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase)
    XRBaseInteractor.StartManualInteraction(IXRSelectInteractable)
    XRBaseInteractor.EndManualInteraction()
    XRBaseInteractor.ProcessHoverFilters(IXRHoverInteractable)
    XRBaseInteractor.ProcessSelectFilters(IXRSelectInteractable)
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, bool)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>(bool)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, bool)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsByType<T>(FindObjectsSortMode)
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindFirstObjectByType<T>()
    Object.FindAnyObjectByType<T>()
    Object.FindFirstObjectByType<T>(FindObjectsInactive)
    Object.FindAnyObjectByType<T>(FindObjectsInactive)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.Interaction.Toolkit.Interactors
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
    public abstract class XRBaseInputInteractor : XRBaseInteractor, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRGroupMember, IXRInteractionStrengthInteractor, IXRActivateInteractor, IXRInteractor

    Properties

    activateInput

    Input to use for activating an interactable. This can be used to trigger a secondary action on an interactable object, such as pulling a trigger on a ball launcher after picking it up.

    Declaration
    public XRInputButtonReader activateInput { get; set; }
    Property Value
    Type Description
    XRInputButtonReader

    allowActivate

    Defines whether this interactor allows sending activate and deactivate events.

    Declaration
    public bool allowActivate { get; set; }
    Property Value
    Type Description
    bool
    See Also
    allowHoveredActivate
    shouldActivate
    shouldDeactivate

    allowHoveredActivate

    Controls whether to send activate and deactivate events to interactables that this interactor is hovered over but not selected when there is no current selection. By default, the interactor will only send activate and deactivate events to interactables that it's selected.

    Declaration
    public bool allowHoveredActivate { get; set; }
    Property Value
    Type Description
    bool
    See Also
    allowActivate
    GetActivateTargets(List<IXRActivateInteractable>)

    buttonReaders

    The list of button input readers used by this interactor. This interactor will automatically enable or disable direct actions if that mode is used during OnEnable() and OnDisable().

    Declaration
    protected List<XRInputButtonReader> buttonReaders { get; }
    Property Value
    Type Description
    List<XRInputButtonReader>
    See Also
    EnableDirectActionIfModeUsed()
    DisableDirectActionIfModeUsed()

    isSelectActive

    (Read Only) Indicates whether this Interactor is in a state where it could select.

    Declaration
    public override bool isSelectActive { get; }
    Property Value
    Type Description
    bool
    Overrides
    XRBaseInteractor.isSelectActive

    logicalActivateState

    The logical state of the activate input.

    Declaration
    public XRBaseInputInteractor.LogicalInputState logicalActivateState { get; }
    Property Value
    Type Description
    XRBaseInputInteractor.LogicalInputState
    See Also
    activateInput

    logicalSelectState

    The logical state of the select input.

    Declaration
    public XRBaseInputInteractor.LogicalInputState logicalSelectState { get; }
    Property Value
    Type Description
    XRBaseInputInteractor.LogicalInputState
    See Also
    selectInput

    selectActionTrigger

    Choose how Unity interprets the select input. Controls between different input styles for determining if this interactor can select, such as whether the button is currently held or whether the button toggles select upon being pressed.

    Declaration
    public XRBaseInputInteractor.InputTriggerType selectActionTrigger { get; set; }
    Property Value
    Type Description
    XRBaseInputInteractor.InputTriggerType
    See Also
    XRBaseInputInteractor.InputTriggerType
    logicalSelectState

    selectInput

    Input to use for selecting an interactable.

    Declaration
    public XRInputButtonReader selectInput { get; set; }
    Property Value
    Type Description
    XRInputButtonReader

    shouldActivate

    (Read Only) Indicates whether this interactor is in a state where it should send the activate event this frame.

    Declaration
    public virtual bool shouldActivate { get; }
    Property Value
    Type Description
    bool

    shouldDeactivate

    (Read Only) Indicates whether this interactor is in a state where it should send the deactivate event this frame.

    Declaration
    public virtual bool shouldDeactivate { get; }
    Property Value
    Type Description
    bool

    targetPriorityMode

    Specifies how many Interactables should be monitored in the targetsForSelection property.

    Declaration
    public override TargetPriorityMode targetPriorityMode { get; set; }
    Property Value
    Type Description
    TargetPriorityMode
    Overrides
    XRBaseInteractor.targetPriorityMode

    valueReaders

    The list of value input readers used by this interactor. This interactor will automatically enable or disable direct actions if that mode is used during OnEnable() and OnDisable().

    Declaration
    protected List<XRInputValueReader> valueReaders { get; }
    Property Value
    Type Description
    List<XRInputValueReader>
    See Also
    EnableDirectActionIfModeUsed()
    DisableDirectActionIfModeUsed()

    Methods

    Awake()

    See MonoBehaviour.

    Declaration
    protected override void Awake()
    Overrides
    XRBaseInteractor.Awake()

    GetActivateTargets(List<IXRActivateInteractable>)

    Retrieve the list of Interactables that this Interactor could possibly activate or deactivate this frame.

    Declaration
    public virtual void GetActivateTargets(List<IXRActivateInteractable> targets)
    Parameters
    Type Name Description
    List<IXRActivateInteractable> targets

    The results list to populate with Interactables that are valid for activate or deactivate.

    Remarks

    When implementing this method, Unity expects you to clear targets before adding to it.

    OnDisable()

    See MonoBehaviour.

    Declaration
    protected override void OnDisable()
    Overrides
    XRBaseInteractor.OnDisable()

    OnEnable()

    See MonoBehaviour.

    Declaration
    protected override void OnEnable()
    Overrides
    XRBaseInteractor.OnEnable()

    OnHoverEntering(HoverEnterEventArgs)

    The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.

    Declaration
    protected override void OnHoverEntering(HoverEnterEventArgs args)
    Parameters
    Type Name Description
    HoverEnterEventArgs args

    Event data containing the Interactable that is being hovered over.

    Overrides
    XRBaseInteractor.OnHoverEntering(HoverEnterEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    OnHoverExiting(HoverExitEventArgs)

    The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.

    Declaration
    protected override void OnHoverExiting(HoverExitEventArgs args)
    Parameters
    Type Name Description
    HoverExitEventArgs args

    Event data containing the Interactable that is no longer hovered over.

    Overrides
    XRBaseInteractor.OnHoverExiting(HoverExitEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnHoverExited(HoverExitEventArgs)

    OnSelectEntering(SelectEnterEventArgs)

    The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.

    Declaration
    protected override void OnSelectEntering(SelectEnterEventArgs args)
    Parameters
    Type Name Description
    SelectEnterEventArgs args

    Event data containing the Interactable that is being selected.

    Overrides
    XRBaseInteractor.OnSelectEntering(SelectEnterEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnSelectEntered(SelectEnterEventArgs)

    OnSelectExiting(SelectExitEventArgs)

    The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.

    Declaration
    protected override void OnSelectExiting(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactable that is no longer selected.

    Overrides
    XRBaseInteractor.OnSelectExiting(SelectExitEventArgs)
    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnSelectExited(SelectExitEventArgs)

    PlayAudio(AudioClip)

    Play an AudioClip.

    Declaration
    protected virtual void PlayAudio(AudioClip audioClip)
    Parameters
    Type Name Description
    AudioClip audioClip

    The clip to play.

    PreprocessInteractor(UpdatePhase)

    The XRInteractionManager or containing IXRInteractionGroup calls this method to update the Interactor before interaction events occur. Interactors should use this method to do tasks like determine their valid targets.

    Declaration
    public override void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase

    The update phase this is called during.

    Overrides
    XRBaseInteractor.PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    Remarks

    Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.

    See Also
    XRInteractionUpdateOrder.UpdatePhase

    ProcessInteractor(UpdatePhase)

    The XRInteractionManager or containing IXRInteractionGroup calls this method to update the Interactor after interaction events occur.

    Declaration
    public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase

    The update phase this is called during.

    Overrides
    XRBaseInteractor.ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    Remarks

    Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.

    See Also
    XRInteractionUpdateOrder.UpdatePhase
    ProcessInteractable(UpdatePhase)

    SendHapticImpulse(float, float)

    Play a haptic impulse on the controller if one is available.

    Declaration
    public bool SendHapticImpulse(float amplitude, float duration)
    Parameters
    Type Name Description
    float amplitude

    Amplitude (from 0.0 to 1.0) to play impulse at.

    float duration

    Duration (in seconds) to play haptic impulse.

    Returns
    Type Description
    bool

    Returns true if successful. Otherwise, returns false.

    See Also
    SendHapticImpulse(float, float)

    SetInputProperty(ref XRInputButtonReader, XRInputButtonReader)

    Helper method for setting an input property.

    Declaration
    protected void SetInputProperty(ref XRInputButtonReader property, XRInputButtonReader value)
    Parameters
    Type Name Description
    XRInputButtonReader property

    The ref to the field.

    XRInputButtonReader value

    The new value being set.

    Remarks

    If the application is playing, this method will also enable or disable directly embedded input actions serialized by the input if that mode is used. It will also add or remove the input from the list of button inputs to automatically manage enabling and disabling direct actions with this behavior.

    See Also
    buttonReaders

    SetInputProperty<TValue>(ref XRInputValueReader<TValue>, XRInputValueReader<TValue>)

    Helper method for setting an input property.

    Declaration
    protected void SetInputProperty<TValue>(ref XRInputValueReader<TValue> property, XRInputValueReader<TValue> value) where TValue : struct
    Parameters
    Type Name Description
    XRInputValueReader<TValue> property

    The ref to the field.

    XRInputValueReader<TValue> value

    The new value being set.

    Type Parameters
    Name Description
    TValue

    Type of the value read by the property, such as Vector2 or float.

    Remarks

    If the application is playing, this method will also enable or disable directly embedded input actions serialized by the input if that mode is used. It will also add or remove the input from the list of value inputs to automatically manage enabling and disabling direct actions with this behavior.

    See Also
    valueReaders

    Implements

    IXRHoverInteractor
    IXRSelectInteractor
    IXRTargetPriorityInteractor
    IXRGroupMember
    IXRInteractionStrengthInteractor
    IXRActivateInteractor
    IXRInteractor

    Extension Methods

    XRGroupMemberExtensions.GetTopLevelContainingGroup(IXRGroupMember)
    XRHoverInteractorExtensions.GetOldestInteractableHovered(IXRHoverInteractor)
    XRInteractorExtensions.IsBlockedByInteractionWithinGroup(IXRInteractor)
    XRSelectInteractorExtensions.GetOldestInteractableSelected(IXRSelectInteractor)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)