docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRBaseInteractor

    Abstract base class from which all interactor behaviors derive. This class hooks into the interaction system (via XRInteractionManager) and provides base virtual methods for handling hover and selection.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseInteractor
    XRBaseInputInteractor
    XRPokeInteractor
    XRSocketInteractor
    ClimbTeleportInteractor
    Implements
    IXRHoverInteractor
    IXRSelectInteractor
    IXRTargetPriorityInteractor
    IXRGroupMember
    IXRInteractionStrengthInteractor
    IXRInteractor
    Inherited Members
    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")]
    [SelectionBase]
    [DisallowMultipleComponent]
    [DefaultExecutionOrder(-99)]
    public abstract class XRBaseInteractor : MonoBehaviour, IXRHoverInteractor, IXRSelectInteractor, IXRTargetPriorityInteractor, IXRGroupMember, IXRInteractionStrengthInteractor, IXRInteractor

    Properties

    allowHover

    Defines whether this interactor allows hover events.

    Declaration
    public bool allowHover { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    A hover exit event will still occur if this value is disabled while hovering.

    allowSelect

    Defines whether this interactor allows select events.

    Declaration
    public bool allowSelect { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    A select exit event will still occur if this value is disabled while selecting.

    attachTransform

    The Transform that is used as the attach point for Interactables.

    Declaration
    public Transform attachTransform { get; set; }
    Property Value
    Type Description
    Transform
    Remarks

    Automatically instantiated and set in Awake() if null. Setting this will not automatically destroy the previous object.

    containingGroup

    The Interaction Group that contains this member.

    Declaration
    public IXRInteractionGroup containingGroup { get; }
    Property Value
    Type Description
    IXRInteractionGroup

    disableVisualsWhenBlockedInGroup

    Whether to disable Interactor visuals (such as XRInteractorLineVisual) when this Interactor is part of an IXRInteractionGroup and is incapable of interacting due to active interaction by another Interactor in the Group.

    Declaration
    public bool disableVisualsWhenBlockedInGroup { get; set; }
    Property Value
    Type Description
    bool

    firstInteractableSelected

    (Read Only) The first Interactable selected since not having any selection. This Interactor may not currently be selecting the Interactable, which would be the case when it was released while multiple Interactables were selected.

    Declaration
    public IXRSelectInteractable firstInteractableSelected { get; }
    Property Value
    Type Description
    IXRSelectInteractable
    See Also
    firstInteractorSelecting

    handedness

    Represents which hand or controller the interactor is associated with.

    Declaration
    public InteractorHandedness handedness { get; set; }
    Property Value
    Type Description
    InteractorHandedness

    hasHover

    (Read Only) Indicates whether this Interactor is currently hovering an Interactable.

    Declaration
    public bool hasHover { get; }
    Property Value
    Type Description
    bool
    Remarks

    In other words, returns whether interactablesHovered contains any Interactables.

    Examples
      interactablesHovered.Count > 0
    
    See Also
    interactablesHovered
    isHovered

    hasSelection

    (Read Only) Indicates whether this Interactor is currently selecting an Interactable.

    Declaration
    public bool hasSelection { get; }
    Property Value
    Type Description
    bool
    Remarks

    In other words, returns whether interactablesSelected contains any Interactables.

    Examples
      interactablesSelected.Count > 0
    
    See Also
    interactablesSelected
    isSelected

    hoverEntered

    The event that is called when this Interactor begins hovering over an Interactable.

    Declaration
    public HoverEnterEvent hoverEntered { get; set; }
    Property Value
    Type Description
    HoverEnterEvent
    Remarks

    The HoverEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    hoverExited

    hoverExited

    The event that is called when this Interactor ends hovering over an Interactable.

    Declaration
    public HoverExitEvent hoverExited { get; set; }
    Property Value
    Type Description
    HoverExitEvent
    Remarks

    The HoverExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    hoverEntered

    hoverFilters

    The list of hover filters in this object. Used as additional hover validations for this Interactor.

    Declaration
    public IXRFilterList<IXRHoverFilter> hoverFilters { get; }
    Property Value
    Type Description
    IXRFilterList<IXRHoverFilter>
    Remarks

    While processing hover filters, all changes to this list don't have an immediate effect. These changes are buffered and applied when the processing is finished. Calling MoveTo(T, int) in this list will throw an exception when this list is being processed.

    See Also
    ProcessHoverFilters(IXRHoverInteractable)

    interactablesHovered

    (Read Only) The list of Interactables that are currently being hovered over (may by empty).

    Declaration
    public List<IXRHoverInteractable> interactablesHovered { get; }
    Property Value
    Type Description
    List<IXRHoverInteractable>
    Remarks

    You should treat this as a read only view of the list and should not modify it. It is exposed as a List<T> rather than an IReadOnlyList<T> to avoid GC Allocations when enumerating the list.

    See Also
    hasHover
    interactorsHovering

    interactablesSelected

    (Read Only) The list of Interactables that are currently being selected (may by empty).

    Declaration
    public List<IXRSelectInteractable> interactablesSelected { get; }
    Property Value
    Type Description
    List<IXRSelectInteractable>
    Remarks

    This should be treated as a read only view of the list and should not be modified by external callers. It is exposed as a List<T> rather than an IReadOnlyList<T> to avoid GC Allocations when enumerating the list.

    See Also
    hasSelection
    interactorsSelecting

    interactionLayers

    Allows interaction with Interactables whose Interaction Layer Mask overlaps with any Layer in this Interaction Layer Mask.

    Declaration
    public InteractionLayerMask interactionLayers { get; set; }
    Property Value
    Type Description
    InteractionLayerMask
    See Also
    interactionLayers
    CanHover(IXRHoverInteractable)
    CanSelect(IXRSelectInteractable)
    interactionLayers

    interactionManager

    The XRInteractionManager that this Interactor will communicate with (will find one if null).

    Declaration
    public XRInteractionManager interactionManager { get; set; }
    Property Value
    Type Description
    XRInteractionManager

    isHoverActive

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

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

    isPerformingManualInteraction

    Defines whether this interactor is performing a manual interaction or not.

    Declaration
    public bool isPerformingManualInteraction { get; }
    Property Value
    Type Description
    bool
    See Also
    StartManualInteraction(IXRSelectInteractable)
    EndManualInteraction()

    isSelectActive

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

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

    keepSelectedTargetValid

    Whether to keep selecting an Interactable after initially selecting it even when it is no longer a valid target.

    Declaration
    public bool keepSelectedTargetValid { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    Return true to make the XRInteractionManager retain the selection even if the Interactable is not contained within the list of valid targets. Return false to make the Interaction Manager clear the selection if it isn't within the list of valid targets.
    A common use for disabling this is for Ray Interactors used for teleportation to make the teleportation Interactable no longer selected when not currently pointing at it.

    largestInteractionStrength

    The largest interaction strength value of all interactables this interactor is hovering or selecting.

    Declaration
    public IReadOnlyBindableVariable<float> largestInteractionStrength { get; }
    Property Value
    Type Description
    IReadOnlyBindableVariable<float>

    selectEntered

    The event that is called when this Interactor begins selecting an Interactable.

    Declaration
    public SelectEnterEvent selectEntered { get; set; }
    Property Value
    Type Description
    SelectEnterEvent
    Remarks

    The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    selectExited

    selectExited

    The event that is called when this Interactor ends selecting an Interactable.

    Declaration
    public SelectExitEvent selectExited { get; set; }
    Property Value
    Type Description
    SelectExitEvent
    Remarks

    The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    selectEntered

    selectFilters

    The list of select filters in this object. Used as additional select validations for this Interactor.

    Declaration
    public IXRFilterList<IXRSelectFilter> selectFilters { get; }
    Property Value
    Type Description
    IXRFilterList<IXRSelectFilter>
    Remarks

    While processing select filters, all changes to this list don't have an immediate effect. These changes are buffered and applied when the processing is finished. Calling MoveTo(T, int) in this list will throw an exception when this list is being processed.

    See Also
    ProcessSelectFilters(IXRSelectInteractable)

    selectedInteractableMovementTypeOverride

    (Read Only) Overriding movement type of the selected Interactable's movement. By default, this does not override the movement type.

    Declaration
    public virtual XRBaseInteractable.MovementType? selectedInteractableMovementTypeOverride { get; }
    Property Value
    Type Description
    XRBaseInteractable.MovementType?
    Remarks

    You can use this to change the effective movement type of an Interactable for different Interactors. An example would be having an Interactable use VelocityTracking so it does not move through geometry with a Collider when interacting with it using a Ray or Direct Interactor, but have a Socket Interactor override the movement type to be Instantaneous for reduced movement latency.

    See Also
    movementType

    startingHoverFilters

    The hover filters that this object uses to automatically populate the hoverFilters List at startup (optional, may be empty). All objects in this list should implement the IXRHoverFilter interface.

    Declaration
    public List<Object> startingHoverFilters { get; set; }
    Property Value
    Type Description
    List<Object>
    Remarks

    To access and modify the hover filters used after startup, the hoverFilters List should be used instead.

    See Also
    hoverFilters

    startingSelectFilters

    The select filters that this object uses to automatically populate the selectFilters List at startup (optional, may be empty). All objects in this list should implement the IXRSelectFilter interface.

    Declaration
    public List<Object> startingSelectFilters { get; set; }
    Property Value
    Type Description
    List<Object>
    Remarks

    To access and modify the select filters used after startup, the selectFilters List should be used instead.

    See Also
    selectFilters

    startingSelectedInteractable

    The Interactable that this Interactor automatically selects at startup (optional, may be null).

    Declaration
    public XRBaseInteractable startingSelectedInteractable { get; set; }
    Property Value
    Type Description
    XRBaseInteractable

    startingTargetFilter

    The Target Filter that this Interactor automatically links at startup (optional, may be null).

    Declaration
    public XRBaseTargetFilter startingTargetFilter { get; set; }
    Property Value
    Type Description
    XRBaseTargetFilter
    Remarks

    To modify the Target Filter after startup, the targetFilter property should be used instead.

    See Also
    targetFilter

    targetFilter

    The Target Filter that this Interactor is linked to.

    Declaration
    public IXRTargetFilter targetFilter { get; set; }
    Property Value
    Type Description
    IXRTargetFilter
    See Also
    startingTargetFilter

    targetPriorityMode

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

    Declaration
    public virtual TargetPriorityMode targetPriorityMode { get; set; }
    Property Value
    Type Description
    TargetPriorityMode

    targetsForSelection

    The Interactables with priority for selection in the current frame, some Interactables might be already selected. This list is sorted by priority (with highest priority first). How many Interactables appear in this list is configured by the targetPriorityMode property.

    Declaration
    public virtual List<IXRSelectInteractable> targetsForSelection { get; set; }
    Property Value
    Type Description
    List<IXRSelectInteractable>
    Remarks

    Unity automatically clears and updates this list every frame if targetPriorityMode has a value different from None, in this case a valid list must be returned.

    Methods

    Awake()

    See MonoBehaviour.

    Declaration
    protected virtual void Awake()

    CanHover(IXRHoverInteractable)

    Determines if the Interactable is valid for hover this frame.

    Declaration
    public virtual bool CanHover(IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractable interactable

    Interactable to check.

    Returns
    Type Description
    bool

    Returns true if the Interactable can be hovered over this frame.

    See Also
    IsHoverableBy(IXRHoverInteractor)

    CanSelect(IXRSelectInteractable)

    Determines if the Interactable is valid for selection this frame.

    Declaration
    public virtual bool CanSelect(IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractable interactable

    Interactable to check.

    Returns
    Type Description
    bool

    Returns true if the Interactable can be selected this frame.

    See Also
    IsSelectableBy(IXRSelectInteractor)

    CaptureAttachPose(IXRSelectInteractable)

    Capture the current Attach Transform pose. This method is automatically called by Unity to capture the pose during the moment of selection.

    Declaration
    protected void CaptureAttachPose(IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractable interactable

    The specific Interactable as context to get the attachment point for.

    Remarks

    Unity automatically calls this method during OnSelectEntering(SelectEnterEventArgs) and should not typically need to be called by a user.

    See Also
    GetAttachPoseOnSelect(IXRSelectInteractable)
    GetLocalAttachPoseOnSelect(IXRSelectInteractable)
    CaptureAttachPose(IXRSelectInteractor)

    CreateAttachTransform()

    Create a new child GameObject to use as the attach transform if one is not set.

    Declaration
    protected void CreateAttachTransform()
    See Also
    attachTransform

    EndManualInteraction()

    Ends the manually initiated selection of an Interactable.

    Declaration
    public virtual void EndManualInteraction()
    See Also
    StartManualInteraction(IXRSelectInteractable)

    GetAttachPoseOnSelect(IXRSelectInteractable)

    Gets the world position and rotation of the Attach Transform captured during the moment of selection.

    Declaration
    public Pose GetAttachPoseOnSelect(IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractable interactable

    The specific Interactable as context to get the attachment point for.

    Returns
    Type Description
    Pose

    Returns the world pose of the attachment point during the moment of selection, and otherwise the identity Pose if it was not selected during the current selection stack.

    See Also
    GetLocalAttachPoseOnSelect(IXRSelectInteractable)
    GetAttachTransform(IXRInteractable)
    GetAttachPoseOnSelect(IXRSelectInteractor)

    GetAttachTransform(IXRInteractable)

    Gets the Transform that is used as the attachment point for a given Interactable.

    Declaration
    public virtual Transform GetAttachTransform(IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractable interactable

    The specific Interactable as context to get the attachment point for.

    Returns
    Type Description
    Transform

    Returns the attachment point Transform.

    Remarks

    This should typically return the Transform of a child GameObject or the transform itself.

    See Also
    GetAttachTransform(IXRInteractor)

    GetInteractionStrength(IXRInteractable)

    Gets the interaction strength between the given interactable and this interactor.

    Declaration
    public float GetInteractionStrength(IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractable interactable

    The specific interactable to get the interaction strength between.

    Returns
    Type Description
    float

    Returns a value [0.0, 1.0] of the interaction strength.

    GetLocalAttachPoseOnSelect(IXRSelectInteractable)

    Gets the local position and rotation of the Attach Transform captured during the moment of selection.

    Declaration
    public Pose GetLocalAttachPoseOnSelect(IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractable interactable

    The specific Interactable as context to get the attachment point for.

    Returns
    Type Description
    Pose

    Returns the local pose of the attachment point during the moment of selection, and otherwise the identity Pose if it was not selected during the current selection stack.

    See Also
    GetAttachPoseOnSelect(IXRSelectInteractable)
    GetAttachTransform(IXRInteractable)
    GetLocalAttachPoseOnSelect(IXRSelectInteractor)

    GetValidTargets(List<IXRInteractable>)

    Retrieve the list of Interactables that this Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first).

    Declaration
    public virtual void GetValidTargets(List<IXRInteractable> targets)
    Parameters
    Type Name Description
    List<IXRInteractable> targets

    The results list to populate with Interactables that are valid for selection or hover.

    Remarks

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

    IsHovering(IXRHoverInteractable)

    Determines whether this Interactor is currently hovering the Interactable.

    Declaration
    public bool IsHovering(IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractable interactable

    Interactable to check.

    Returns
    Type Description
    bool

    Returns true if this Interactor is currently hovering the Interactable. Otherwise, returns false.

    Remarks

    In other words, returns whether interactablesHovered contains interactable.

    See Also
    interactablesHovered

    IsHovering(IXRInteractable)

    Determines whether this Interactor is currently hovering the Interactable.

    Declaration
    protected bool IsHovering(IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractable interactable

    Interactable to check.

    Returns
    Type Description
    bool

    Returns true if this Interactor is currently hovering the Interactable. Otherwise, returns false.

    Remarks

    In other words, returns whether interactablesHovered contains interactable.

    See Also
    interactablesHovered
    IsHovering(IXRHoverInteractable)

    IsSelecting(IXRInteractable)

    Determines whether this Interactor is currently selecting the Interactable.

    Declaration
    protected bool IsSelecting(IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractable interactable

    Interactable to check.

    Returns
    Type Description
    bool

    Returns true if this Interactor is currently selecting the Interactable. Otherwise, returns false.

    Remarks

    In other words, returns whether interactablesSelected contains interactable.

    See Also
    interactablesSelected
    IsSelecting(IXRSelectInteractable)

    IsSelecting(IXRSelectInteractable)

    Determines whether this Interactor is currently selecting the Interactable.

    Declaration
    public bool IsSelecting(IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractable interactable

    Interactable to check.

    Returns
    Type Description
    bool

    Returns true if this Interactor is currently selecting the Interactable. Otherwise, returns false.

    Remarks

    In other words, returns whether interactablesSelected contains interactable.

    See Also
    interactablesSelected

    OnDestroy()

    See MonoBehaviour.

    Declaration
    protected virtual void OnDestroy()

    OnDisable()

    See MonoBehaviour.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    See MonoBehaviour.

    Declaration
    protected virtual void OnEnable()

    OnHoverEntered(HoverEnterEventArgs)

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

    Declaration
    protected virtual void OnHoverEntered(HoverEnterEventArgs args)
    Parameters
    Type Name Description
    HoverEnterEventArgs args

    Event data containing the Interactable that is being hovered over.

    Remarks

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

    See Also
    OnHoverExited(HoverExitEventArgs)

    OnHoverEntering(HoverEnterEventArgs)

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

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

    Event data containing the Interactable that is being hovered over.

    Remarks

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

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    OnHoverExited(HoverExitEventArgs)

    The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.

    Declaration
    protected virtual void OnHoverExited(HoverExitEventArgs args)
    Parameters
    Type Name Description
    HoverExitEventArgs args

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

    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 virtual void OnHoverExiting(HoverExitEventArgs args)
    Parameters
    Type Name Description
    HoverExitEventArgs args

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

    Remarks

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

    See Also
    OnHoverExited(HoverExitEventArgs)

    OnRegistered(InteractorRegisteredEventArgs)

    The XRInteractionManager calls this method when this Interactor is registered with it.

    Declaration
    protected virtual void OnRegistered(InteractorRegisteredEventArgs args)
    Parameters
    Type Name Description
    InteractorRegisteredEventArgs args

    Event data containing the Interaction Manager that registered this Interactor.

    Remarks

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

    See Also
    RegisterInteractor(IXRInteractor)

    OnSelectEntered(SelectEnterEventArgs)

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

    Declaration
    protected virtual void OnSelectEntered(SelectEnterEventArgs args)
    Parameters
    Type Name Description
    SelectEnterEventArgs args

    Event data containing the Interactable that is being selected.

    Remarks

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

    See Also
    OnSelectExited(SelectExitEventArgs)

    OnSelectEntering(SelectEnterEventArgs)

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

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

    Event data containing the Interactable that is being selected.

    Remarks

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

    See Also
    OnSelectEntered(SelectEnterEventArgs)

    OnSelectExited(SelectExitEventArgs)

    The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.

    Declaration
    protected virtual void OnSelectExited(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactable that is no longer selected.

    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 virtual void OnSelectExiting(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactable that is no longer selected.

    Remarks

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

    See Also
    OnSelectExited(SelectExitEventArgs)

    OnUnregistered(InteractorUnregisteredEventArgs)

    The XRInteractionManager calls this method when this Interactor is unregistered from it.

    Declaration
    protected virtual void OnUnregistered(InteractorUnregisteredEventArgs args)
    Parameters
    Type Name Description
    InteractorUnregisteredEventArgs args

    Event data containing the Interaction Manager that unregistered this Interactor.

    Remarks

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

    See Also
    UnregisterInteractor(IXRInteractor)

    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 virtual void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase

    The update phase this is called during.

    Remarks

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

    See Also
    XRInteractionUpdateOrder.UpdatePhase

    ProcessHoverFilters(IXRHoverInteractable)

    Returns the processing value of the filters in hoverFilters for this Interactor and the given Interactable.

    Declaration
    protected bool ProcessHoverFilters(IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractable interactable

    The Interactable to be validated by the hover filters.

    Returns
    Type Description
    bool

    Returns true if all processed filters also return true, or if hoverFilters is empty. Otherwise, returns false.

    ProcessInteractionStrength(UpdatePhase)

    The XRInteractionManager calls this method to signal to update the interaction strength.

    Declaration
    protected virtual void ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase

    The update phase during which this method is called.

    See Also
    GetInteractionStrength(IXRInteractable)
    ProcessInteractionStrength(UpdatePhase)

    ProcessInteractor(UpdatePhase)

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

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

    The update phase this is called during.

    Remarks

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

    See Also
    XRInteractionUpdateOrder.UpdatePhase
    ProcessInteractable(UpdatePhase)

    ProcessSelectFilters(IXRSelectInteractable)

    Returns the processing value of the filters in selectFilters for this Interactor and the given Interactable.

    Declaration
    protected bool ProcessSelectFilters(IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractable interactable

    The Interactor to be validated by the select filters.

    Returns
    Type Description
    bool

    Returns true if all processed filters also return true, or if selectFilters is empty. Otherwise, returns false.

    Reset()

    See MonoBehaviour.

    Declaration
    [Conditional("UNITY_EDITOR")]
    protected virtual void Reset()

    Start()

    See MonoBehaviour.

    Declaration
    protected virtual void Start()

    StartManualInteraction(IXRSelectInteractable)

    Manually initiate selection of an Interactable.

    Declaration
    public virtual void StartManualInteraction(IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractable interactable

    Interactable that is being selected.

    See Also
    EndManualInteraction()

    Events

    registered

    Calls the methods in its invocation list when this Interactor is registered with an Interaction Manager.

    Declaration
    public event Action<InteractorRegisteredEventArgs> registered
    Event Type
    Type Description
    Action<InteractorRegisteredEventArgs>
    Remarks

    The InteractorRegisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    interactorRegistered

    unregistered

    Calls the methods in its invocation list when this Interactor is unregistered from an Interaction Manager.

    Declaration
    public event Action<InteractorUnregisteredEventArgs> unregistered
    Event Type
    Type Description
    Action<InteractorUnregisteredEventArgs>
    Remarks

    The InteractorUnregisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    interactorUnregistered

    Implements

    IXRHoverInteractor
    IXRSelectInteractor
    IXRTargetPriorityInteractor
    IXRGroupMember
    IXRInteractionStrengthInteractor
    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)