docs.unity3d.com
    Show / Hide Table of Contents

    Interface IXRSelectInteractable

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

    Inherited Members
    IXRInteractable.registered
    IXRInteractable.unregistered
    IXRInteractable.interactionLayers
    IXRInteractable.colliders
    IXRInteractable.transform
    IXRInteractable.GetAttachTransform(IXRInteractor)
    IXRInteractable.OnRegistered(InteractableRegisteredEventArgs)
    IXRInteractable.OnUnregistered(InteractableUnregisteredEventArgs)
    IXRInteractable.ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
    IXRInteractable.GetDistanceSqrToInteractor(IXRInteractor)
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    public interface IXRSelectInteractable : IXRInteractable

    Properties

    firstInteractorSelecting

    (Read Only) The first interactor that selected this interactable since not being selected by any interactor. The interactor may not currently be selecting this interactable, which would be the case when it released while multiple interactors were selecting this interactable.

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

    firstSelectEntered

    The event that is called only when the first Interactor begins selecting this Interactable as the sole selecting Interactor. Subsequent Interactors that begin selecting this Interactable will not cause this event to be invoked as long as any others are still selecting.

    Declaration
    SelectEnterEvent firstSelectEntered { 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
    lastSelectExited
    selectEntered

    interactorsSelecting

    (Read Only) The list of Interactors currently selecting this Interactable (may by empty).

    Declaration
    List<IXRSelectInteractor> interactorsSelecting { get; }
    Property Value
    Type Description
    List<IXRSelectInteractor>
    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
    isSelected
    interactablesSelected

    isSelected

    (Read Only) Indicates whether this interactable is currently being selected by any interactor.

    Declaration
    bool isSelected { get; }
    Property Value
    Type Description
    Boolean
    Remarks

    In other words, returns whether interactorsSelecting contains any interactors.

    interactorsSelecting.Count > 0

    See Also
    interactorsSelecting
    hasSelection

    lastSelectExited

    The event that is called only when the last remaining selecting Interactor ends selecting this Interactable.

    Declaration
    SelectExitEvent lastSelectExited { get; }
    Property Value
    Type Description
    SelectExitEvent
    Remarks

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

    See Also
    firstSelectEntered
    selectExited

    selectEntered

    The event that is called when an Interactor begins selecting this 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 an Interactor ends selecting this Interactable.

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

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

    See Also
    selectEntered

    selectMode

    Indicates the selection policy of an Interactable.

    Declaration
    InteractableSelectMode selectMode { get; }
    Property Value
    Type Description
    InteractableSelectMode
    See Also
    InteractableSelectMode

    Methods

    GetAttachPoseOnSelect(IXRSelectInteractor)

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

    Declaration
    Pose GetAttachPoseOnSelect(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The specific Interactor 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 by it during the current selection stack.

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

    GetLocalAttachPoseOnSelect(IXRSelectInteractor)

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

    Declaration
    Pose GetLocalAttachPoseOnSelect(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The specific Interactor 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 by it during the current selection stack.

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

    IsSelectableBy(IXRSelectInteractor)

    Determines if a given Interactor can select this Interactable.

    Declaration
    bool IsSelectableBy(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    Interactor to check for a valid selection with.

    Returns
    Type Description
    Boolean

    Returns true if selection is valid this frame. Returns false if not.

    See Also
    CanSelect(IXRSelectInteractable)

    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 Interactor that is initiating the selection.

    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 Interactor that is initiating the selection.

    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 Interactor that is ending the selection.

    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 Interactor that is ending the selection.

    Remarks

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

    See Also
    OnSelectExited(SelectExitEventArgs)

    Extension Methods

    XRSelectInteractableExtensions.GetOldestInteractorSelecting(IXRSelectInteractable)

    See Also

    IXRSelectInteractor
    Back to top
    Terms of use
    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