docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IXRSelectInteractor

    An interface that represents an Interactor component that can select an Interactable component.

    Inherited Members
    IXRInteractor.registered
    IXRInteractor.unregistered
    IXRInteractor.interactionLayers
    IXRInteractor.handedness
    IXRInteractor.transform
    IXRInteractor.GetAttachTransform(IXRInteractable)
    IXRInteractor.GetValidTargets(List<IXRInteractable>)
    IXRInteractor.OnRegistered(InteractorRegisteredEventArgs)
    IXRInteractor.OnUnregistered(InteractorUnregisteredEventArgs)
    IXRInteractor.PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    IXRInteractor.ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    Namespace: UnityEngine.XR.Interaction.Toolkit.Interactors
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
    public interface IXRSelectInteractor : IXRInteractor

    Properties

    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
    IXRSelectInteractable firstInteractableSelected { get; }
    Property Value
    Type Description
    IXRSelectInteractable
    See Also
    firstInteractorSelecting

    hasSelection

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

    Declaration
    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

    interactablesSelected

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

    Declaration
    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

    isSelectActive

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

    Declaration
    bool isSelectActive { get; }
    Property Value
    Type Description
    bool
    See Also
    IXRSelectInteractable

    keepSelectedTargetValid

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

    Declaration
    bool keepSelectedTargetValid { get; }
    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.

    See Also
    IXRSelectInteractable

    selectEntered

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

    Declaration
    SelectEnterEvent selectEntered { get; }
    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
    SelectExitEvent selectExited { get; }
    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

    Methods

    CanSelect(IXRSelectInteractable)

    Determines if the Interactable is valid for selection this frame.

    Declaration
    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)

    GetAttachPoseOnSelect(IXRSelectInteractable)

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

    Declaration
    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)

    GetLocalAttachPoseOnSelect(IXRSelectInteractable)

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

    Declaration
    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)

    IsSelecting(IXRSelectInteractable)

    Determines whether this Interactor is currently selecting the Interactable.

    Declaration
    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

    OnSelectEntered(SelectEnterEventArgs)

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

    Declaration
    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
    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
    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
    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)

    Extension Methods

    XRInteractorExtensions.IsBlockedByInteractionWithinGroup(IXRInteractor)
    XRSelectInteractorExtensions.GetOldestInteractableSelected(IXRSelectInteractor)

    See Also

    IXRSelectInteractable
    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)