docs.unity3d.com
    Show / Hide Table of Contents

    Class XRBaseInteractable

    Abstract base class from which all interactable behaviours 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
    XRBaseInteractable
    ARBaseGestureInteractable
    BaseTeleportationInteractable
    XRGrabInteractable
    XRSimpleInteractable
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(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, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, 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
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    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, Boolean)
    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, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    [SelectionBase]
    [DefaultExecutionOrder(-98)]
    public abstract class XRBaseInteractable : MonoBehaviour, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRInteractable

    Properties

    activated

    The event that is called when the selecting Interactor activates this Interactable.

    Declaration
    public ActivateEvent activated { get; set; }
    Property Value
    Type Description
    ActivateEvent
    Implements
    IXRActivateInteractable.activated
    Remarks

    Not to be confused with activating or deactivating a GameObject with SetActive. This is a generic event when an Interactor wants to activate an Interactable, such as from a trigger pull on a controller.
    The ActivateEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    deactivated

    colliders

    (Read Only) Colliders to use for interaction with this Interactable (if empty, will use any child Colliders).

    Declaration
    public List<Collider> colliders { get; }
    Property Value
    Type Description
    List<Collider>
    Implements
    IXRInteractable.colliders

    customReticle

    The reticle that appears at the end of the line when valid.

    Declaration
    public GameObject customReticle { get; set; }
    Property Value
    Type Description
    GameObject

    deactivated

    The event that is called when an Interactor deactivates this Interactable.

    Declaration
    public DeactivateEvent deactivated { get; set; }
    Property Value
    Type Description
    DeactivateEvent
    Implements
    IXRActivateInteractable.deactivated
    Remarks

    Not to be confused with activating or deactivating a GameObject with SetActive. This is a generic event when an Interactor wants to deactivate an Interactable, such as from a trigger release on a controller.
    The DeactivateEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    activated

    distanceCalculationMode

    Specifies how this Interactable calculates its distance to a location, either using its Transform position, Collider position or Collider volume.

    Declaration
    public XRBaseInteractable.DistanceCalculationMode distanceCalculationMode { get; set; }
    Property Value
    Type Description
    XRBaseInteractable.DistanceCalculationMode
    See Also
    GetDistance(Vector3)
    colliders
    XRBaseInteractable.DistanceCalculationMode

    firstHoverEntered

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

    Declaration
    public HoverEnterEvent firstHoverEntered { get; set; }
    Property Value
    Type Description
    HoverEnterEvent
    Implements
    IXRHoverInteractable.firstHoverEntered
    Remarks

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

    See Also
    lastHoverExited
    hoverEntered

    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
    public IXRSelectInteractor firstInteractorSelecting { get; }
    Property Value
    Type Description
    IXRSelectInteractor
    Implements
    IXRSelectInteractable.firstInteractorSelecting
    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
    public SelectEnterEvent firstSelectEntered { get; set; }
    Property Value
    Type Description
    SelectEnterEvent
    Implements
    IXRSelectInteractable.firstSelectEntered
    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

    getDistanceOverride

    Overriding callback of this object's distance calculation. Use this to change the calculation performed in GetDistance(Vector3) without needing to create a derived class.
    When a callback is assigned to this property, the GetDistance(Vector3) execution calls it to perform the distance calculation instead of using its default calculation (specified by distanceCalculationMode in this base class). Assign null to this property to restore the default calculation.

    Declaration
    public Func<IXRInteractable, Vector3, DistanceInfo> getDistanceOverride { get; set; }
    Property Value
    Type Description
    Func<IXRInteractable, Vector3, DistanceInfo>
    Remarks

    The assigned callback will be invoked to calculate and return the distance information of the point on this Interactable (the first parameter) closest to the given location (the second parameter). The given location and returned distance information are in world space.

    See Also
    GetDistance(Vector3)
    DistanceInfo

    hoverEntered

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

    Declaration
    public HoverEnterEvent hoverEntered { get; set; }
    Property Value
    Type Description
    HoverEnterEvent
    Implements
    IXRHoverInteractable.hoverEntered
    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 an Interactor ends hovering over this Interactable.

    Declaration
    public HoverExitEvent hoverExited { get; set; }
    Property Value
    Type Description
    HoverExitEvent
    Implements
    IXRHoverInteractable.hoverExited
    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

    hoveringInteractors

    (Deprecated) (Read Only) The list of interactors that are hovering on this interactable.

    Declaration
    [Obsolete("hoveringInteractors has been deprecated. Use interactorsHovering instead.")]
    public List<XRBaseInteractor> hoveringInteractors { get; }
    Property Value
    Type Description
    List<XRBaseInteractor>
    See Also
    isHovered
    hoverTargets

    interactionLayerMask

    (Deprecated) Allows interaction with Interactors whose Interaction Layer Mask overlaps with any Layer in this Interaction Layer Mask.

    Declaration
    [Obsolete("interactionLayerMask has been deprecated. Use interactionLayers instead.")]
    public LayerMask interactionLayerMask { get; set; }
    Property Value
    Type Description
    LayerMask
    Remarks

    interactionLayerMask has been deprecated. Use interactionLayers instead.

    See Also
    interactionLayerMask

    interactionLayers

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

    Declaration
    public InteractionLayerMask interactionLayers { get; set; }
    Property Value
    Type Description
    InteractionLayerMask
    Implements
    IXRInteractable.interactionLayers
    See Also
    interactionLayers
    IsHoverableBy(IXRHoverInteractor)
    IsSelectableBy(IXRSelectInteractor)

    interactionManager

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

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

    interactorsHovering

    (Read Only) The list of Interactors that are hovering on this Interactable (may by empty).

    Declaration
    public List<IXRHoverInteractor> interactorsHovering { get; }
    Property Value
    Type Description
    List<IXRHoverInteractor>
    Implements
    IXRHoverInteractable.interactorsHovering
    Remarks

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

    See Also
    isHovered
    interactablesHovered

    interactorsSelecting

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

    Declaration
    public List<IXRSelectInteractor> interactorsSelecting { get; }
    Property Value
    Type Description
    List<IXRSelectInteractor>
    Implements
    IXRSelectInteractable.interactorsSelecting
    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

    isHovered

    (Read Only) Indicates whether an Interactor currently hovers over this Interactable.

    Declaration
    public bool isHovered { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IXRHoverInteractable.isHovered
    Remarks

    In other words, returns whether interactorsHovering contains any interactors.

    interactorsHovering.Count > 0

    See Also
    interactorsHovering
    hasHover

    isSelected

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

    Declaration
    public bool isSelected { get; }
    Property Value
    Type Description
    Boolean
    Implements
    IXRSelectInteractable.isSelected
    Remarks

    In other words, returns whether interactorsSelecting contains any interactors.

    interactorsSelecting.Count > 0

    See Also
    interactorsSelecting
    hasSelection

    lastHoverExited

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

    Declaration
    public HoverExitEvent lastHoverExited { get; set; }
    Property Value
    Type Description
    HoverExitEvent
    Implements
    IXRHoverInteractable.lastHoverExited
    Remarks

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

    See Also
    firstHoverEntered
    hoverExited

    lastSelectExited

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

    Declaration
    public SelectExitEvent lastSelectExited { get; set; }
    Property Value
    Type Description
    SelectExitEvent
    Implements
    IXRSelectInteractable.lastSelectExited
    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

    onActivate

    (Deprecated) Gets or sets the event that Unity calls when an Interactor activates this selected Interactable.

    Declaration
    [Obsolete("onActivate has been deprecated. Use activated with updated signature instead.")]
    public XRInteractableEvent onActivate { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onActivate has been deprecated. Use activated instead.

    onDeactivate

    (Deprecated) Gets or sets the event that Unity calls when an Interactor deactivates this selected Interactable.

    Declaration
    [Obsolete("onDeactivate has been deprecated. Use deactivated with updated signature instead.")]
    public XRInteractableEvent onDeactivate { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onDeactivate has been deprecated. Use deactivated instead.

    onFirstHoverEnter

    (Deprecated) Unity calls this only when the first Interactor begins hovering over this Interactable.

    Declaration
    [Obsolete("onFirstHoverEnter has been deprecated. Use onFirstHoverEntered instead. (UnityUpgradable) -> onFirstHoverEntered")]
    public XRInteractableEvent onFirstHoverEnter { get; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onFirstHoverEnter has been deprecated. Use onFirstHoverEntered instead.

    onFirstHoverEntered

    (Deprecated) Gets or sets the event that Unity calls only when the first Interactor begins hovering over this Interactable as the sole hovering Interactor. Subsequent Interactors that begin hovering over this Interactable will not cause this event to be invoked as long as any others are still hovering.

    Declaration
    [Obsolete("onFirstHoverEntered has been deprecated. Use firstHoverEntered with updated signature instead.")]
    public XRInteractableEvent onFirstHoverEntered { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onFirstHoverEntered has been deprecated. Use firstHoverEntered with updated signature instead.

    onHoverEnter

    (Deprecated) Unity calls this every time an Interactor begins hovering over this Interactable.

    Declaration
    [Obsolete("onHoverEnter has been deprecated. Use onHoverEntered instead. (UnityUpgradable) -> onHoverEntered")]
    public XRInteractableEvent onHoverEnter { get; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onHoverEnter has been deprecated. Use onHoverEntered instead.

    onHoverEntered

    (Deprecated) Gets or sets the event that Unity calls when an Interactor begins hovering over this Interactable.

    Declaration
    [Obsolete("onHoverEntered has been deprecated. Use hoverEntered with updated signature instead.")]
    public XRInteractableEvent onHoverEntered { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onHoverEntered has been deprecated. Use hoverEntered instead.

    onHoverExit

    (Deprecated) Unity calls this every time an Interactor ends hovering over this Interactable.

    Declaration
    [Obsolete("onHoverExit has been deprecated. Use onHoverExited instead. (UnityUpgradable) -> onHoverExited")]
    public XRInteractableEvent onHoverExit { get; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onHoverExit has been deprecated. Use onHoverExited instead.

    onHoverExited

    (Deprecated) Gets or sets the event that Unity calls when an Interactor ends hovering over this Interactable.

    Declaration
    [Obsolete("onHoverExited has been deprecated. Use hoverExited with updated signature instead.")]
    public XRInteractableEvent onHoverExited { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onHoverExited has been deprecated. Use hoverExited hoverExited with updated signature instead.

    onLastHoverExit

    (Deprecated) Unity calls this only when the last Interactor ends hovering over this Interactable.

    Declaration
    [Obsolete("onLastHoverExit has been deprecated. Use onLastHoverExited instead. (UnityUpgradable) -> onLastHoverExited")]
    public XRInteractableEvent onLastHoverExit { get; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onLastHoverExit has been deprecated. Use onLastHoverExited instead.

    onLastHoverExited

    (Deprecated) Gets or sets the event that Unity calls only when the last remaining hovering Interactor ends hovering over this Interactable.

    Declaration
    [Obsolete("onLastHoverExited has been deprecated. Use lastHoverExited with updated signature instead.")]
    public XRInteractableEvent onLastHoverExited { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onLastHoverExited has been deprecated. Use lastHoverExited with updated signature instead.

    onSelectCancel

    (Deprecated) Unity calls this when the Interactor selecting this Interactable is disabled or destroyed.

    Declaration
    [Obsolete("onSelectCancel has been deprecated. Use onSelectCanceled instead. (UnityUpgradable) -> onSelectCanceled")]
    public XRInteractableEvent onSelectCancel { get; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onSelectCancel has been deprecated. Use onSelectCanceled instead.

    onSelectCanceled

    (Deprecated) Gets or sets the event that Unity calls when this Interactable is selected by an Interactor and either is unregistered (such as from being disabled or destroyed).

    Declaration
    [Obsolete("onSelectCanceled has been deprecated. Use selectExited with updated signature and check for args.isCanceled instead.")]
    public XRInteractableEvent onSelectCanceled { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onSelectCanceled has been deprecated. Use selectExited with updated signature and check for isCanceled instead.

    onSelectEnter

    (Deprecated) Unity calls this when an Interactor begins selecting this Interactable.

    Declaration
    [Obsolete("onSelectEnter has been deprecated. Use onSelectEntered instead. (UnityUpgradable) -> onSelectEntered")]
    public XRInteractableEvent onSelectEnter { get; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onSelectEnter has been deprecated. Use onSelectEntered instead.

    onSelectEntered

    (Deprecated) Gets or sets the event that Unity calls when an Interactor begins selecting this Interactable.

    Declaration
    [Obsolete("onSelectEntered has been deprecated. Use selectEntered with updated signature instead.")]
    public XRInteractableEvent onSelectEntered { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onSelectEntered has been deprecated. Use selectEntered with updated signature instead.

    onSelectExit

    (Deprecated) Unity calls this when an Interactor ends selecting this Interactable.

    Declaration
    [Obsolete("onSelectExit has been deprecated. Use onSelectExited instead. (UnityUpgradable) -> onSelectExited")]
    public XRInteractableEvent onSelectExit { get; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onSelectExit has been deprecated. Use onSelectExited instead.

    onSelectExited

    (Deprecated) Gets or sets the event that Unity calls when an Interactor ends selecting this Interactable.

    Declaration
    [Obsolete("onSelectExited has been deprecated. Use selectExited with updated signature and check for !args.isCanceled instead.")]
    public XRInteractableEvent onSelectExited { get; set; }
    Property Value
    Type Description
    XRInteractableEvent
    Remarks

    onSelectExited has been deprecated. Use selectExited with updated signature and check for !isCanceled instead.

    selectEntered

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

    Declaration
    public SelectEnterEvent selectEntered { get; set; }
    Property Value
    Type Description
    SelectEnterEvent
    Implements
    IXRSelectInteractable.selectEntered
    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
    public SelectExitEvent selectExited { get; set; }
    Property Value
    Type Description
    SelectExitEvent
    Implements
    IXRSelectInteractable.selectExited
    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

    selectingInteractor

    (Deprecated) The Interactor selecting this Interactable (may be null).

    Declaration
    [Obsolete("selectingInteractor has been deprecated. Use interactorsSelecting, GetOldestInteractorSelecting, or isSelected for similar functionality.")]
    public XRBaseInteractor selectingInteractor { get; protected set; }
    Property Value
    Type Description
    XRBaseInteractor
    Remarks

    Unity automatically sets this value during OnSelectEntering(SelectEnterEventArgs) and OnSelectExiting(SelectExitEventArgs) and should not typically need to be set by a user. The setter is langword_csharp_protected to allow for rare scenarios where a derived class needs to control this value. Changing this value does not invoke select events.
    selectingInteractor has been deprecated. Use interactorsSelecting or isSelected instead.

    See Also
    isSelected
    selectTarget

    selectMode

    Indicates the selection policy of an Interactable.

    Declaration
    public InteractableSelectMode selectMode { get; set; }
    Property Value
    Type Description
    InteractableSelectMode
    Implements
    IXRSelectInteractable.selectMode
    See Also
    InteractableSelectMode

    Methods

    AttachCustomReticle(IXRInteractor)

    Attaches the custom reticle to the Interactor.

    Declaration
    public virtual void AttachCustomReticle(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    Interactor that is interacting with this Interactable.

    AttachCustomReticle(XRBaseInteractor)

    (Deprecated) Attaches the custom reticle to the Interactor.

    Declaration
    [Obsolete("AttachCustomReticle(XRBaseInteractor) has been deprecated. Use AttachCustomReticle(IXRInteractor) instead.")]
    public virtual void AttachCustomReticle(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is interacting with this Interactable.

    Remarks

    AttachCustomReticle(XRBaseInteractor) has been deprecated. Use AttachCustomReticle(IXRInteractor) instead.

    Awake()

    See MonoBehaviour.

    Declaration
    protected virtual void Awake()

    CaptureAttachPose(IXRSelectInteractor)

    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(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The specific Interactor 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(IXRSelectInteractor)
    GetLocalAttachPoseOnSelect(IXRSelectInteractor)
    CaptureAttachPose(IXRSelectInteractable)

    GetAttachPoseOnSelect(IXRSelectInteractor)

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

    Declaration
    public 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.

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

    GetAttachTransform(IXRInteractor)

    Gets the Transform that serves as the attachment point for a given Interactor.

    Declaration
    public virtual Transform GetAttachTransform(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

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

    Returns
    Type Description
    Transform

    Returns the attachment point Transform.

    Implements
    IXRInteractable.GetAttachTransform(IXRInteractor)
    Remarks

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

    See Also
    GetAttachTransform(IXRInteractable)

    GetDistance(Vector3)

    Gets the distance from this Interactable to the given location. This method uses the calculation mode configured in distanceCalculationMode.
    This method can be overridden (without needing to subclass) by assigning a callback to getDistanceOverride. To restore the previous calculation mode configuration, assign null to getDistanceOverride.

    Declaration
    public virtual DistanceInfo GetDistance(Vector3 position)
    Parameters
    Type Name Description
    Vector3 position

    Location in world space to calculate the distance to.

    Returns
    Type Description
    DistanceInfo

    Returns the distance information (in world space) from this Interactable to the given location.

    Remarks

    This method is used by other methods and systems to calculate this Interactable distance to other objects and locations (GetDistanceSqrToInteractor(IXRInteractor)).

    GetDistanceSqrToInteractor(IXRInteractor)

    Calculates squared distance to an Interactor (based on colliders).

    Declaration
    public virtual float GetDistanceSqrToInteractor(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    Interactor to calculate distance against.

    Returns
    Type Description
    Single

    Returns the minimum squared distance between the Interactor and this Interactable's colliders.

    Implements
    IXRInteractable.GetDistanceSqrToInteractor(IXRInteractor)
    Remarks

    This method calls the GetDistance(Vector3) method to perform the distance calculation.

    GetDistanceSqrToInteractor(XRBaseInteractor)

    (Deprecated) Calculates distance squared to interactor (based on colliders).

    Declaration
    [Obsolete("GetDistanceSqrToInteractor(XRBaseInteractor) has been deprecated. Use GetDistanceSqrToInteractor(IXRInteractor) instead.")]
    public virtual float GetDistanceSqrToInteractor(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor to calculate distance against.

    Returns
    Type Description
    Single

    Returns the minimum distance between the interactor and this interactable's colliders.

    Remarks

    GetDistanceSqrToInteractor(XRBaseInteractor) has been deprecated. Use GetDistanceSqrToInteractor(IXRInteractor) instead.

    GetLocalAttachPoseOnSelect(IXRSelectInteractor)

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

    Declaration
    public 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.

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

    IsHoverableBy(IXRHoverInteractor)

    Determines if a given Interactor can hover over this Interactable.

    Declaration
    public virtual bool IsHoverableBy(IXRHoverInteractor interactor)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    Interactor to check for a valid hover state with.

    Returns
    Type Description
    Boolean

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

    See Also
    CanHover(IXRHoverInteractable)

    IsHoverableBy(XRBaseInteractor)

    (Deprecated) Determines if this interactable can be hovered by a given interactor.

    Declaration
    [Obsolete("IsHoverableBy(XRBaseInteractor) has been deprecated. Use IsHoverableBy(IXRHoverInteractor) instead.")]
    public virtual bool IsHoverableBy(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor to check for a valid hover state with.

    Returns
    Type Description
    Boolean

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

    Remarks

    IsHoverableBy(XRBaseInteractor) has been deprecated. Use IsHoverableBy(IXRHoverInteractor) instead.

    See Also
    CanHover(XRBaseInteractable)

    IsSelectableBy(IXRSelectInteractor)

    Determines if a given Interactor can select this Interactable.

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

    IsSelectableBy(XRBaseInteractor)

    (Deprecated) Determines if a given Interactor can select this Interactable.

    Declaration
    [Obsolete("IsSelectableBy(XRBaseInteractor) has been deprecated. Use IsSelectableBy(IXRSelectInteractor) instead.")]
    public virtual bool IsSelectableBy(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor 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.

    Remarks

    IsSelectableBy(XRBaseInteractor) has been deprecated. Use IsSelectableBy(IXRSelectInteractor) instead.

    See Also
    CanSelect(XRBaseInteractable)

    OnActivate(XRBaseInteractor)

    (Deprecated) The XRBaseControllerInteractor calls this method when the Interactor begins an activation event on this Interactable.

    Declaration
    [Obsolete("OnActivate(XRBaseInteractor) has been deprecated. Use OnActivated(ActivateEventArgs) instead.")]
    protected virtual void OnActivate(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is sending the activate event.

    Remarks

    OnActivate(XRBaseInteractor) has been deprecated. Use OnActivated(ActivateEventArgs) instead.

    See Also
    OnDeactivate(XRBaseInteractor)

    OnActivated(ActivateEventArgs)

    XRBaseControllerInteractor calls this method when the Interactor begins an activation event on this Interactable.

    Declaration
    protected virtual void OnActivated(ActivateEventArgs args)
    Parameters
    Type Name Description
    ActivateEventArgs args

    Event data containing the Interactor that is sending the activate event.

    Remarks

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

    See Also
    OnDeactivated(DeactivateEventArgs)

    OnDeactivate(XRBaseInteractor)

    (Deprecated) The XRBaseControllerInteractor calls this method when the Interactor ends an activation event on this Interactable.

    Declaration
    [Obsolete("OnDeactivate(XRBaseInteractor) has been deprecated. Use OnDeactivated(DeactivateEventArgs) instead.")]
    protected virtual void OnDeactivate(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is sending the deactivate event.

    Remarks

    OnDeactivate(XRBaseInteractor) has been deprecated. Use OnDeactivated(DeactivateEventArgs) instead.

    See Also
    OnActivate(XRBaseInteractor)

    OnDeactivated(DeactivateEventArgs)

    XRBaseControllerInteractor calls this method when the Interactor ends an activation event on this Interactable.

    Declaration
    protected virtual void OnDeactivated(DeactivateEventArgs args)
    Parameters
    Type Name Description
    DeactivateEventArgs args

    Event data containing the Interactor that is sending the deactivate event.

    Remarks

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

    See Also
    OnActivated(ActivateEventArgs)

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

    Remarks

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

    See Also
    OnHoverExited(HoverExitEventArgs)

    OnHoverEntered(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnHoverEntered(XRBaseInteractor) has been deprecated. Use OnHoverEntered(HoverEnterEventArgs) instead.")]
    protected virtual void OnHoverEntered(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is initiating the hover.

    Remarks

    OnHoverEntered(XRBaseInteractor) has been deprecated. Use OnHoverEntered(HoverEnterEventArgs) instead.

    See Also
    OnHoverExited(XRBaseInteractor)

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

    Remarks

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

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    OnHoverEntering(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnHoverEntering(XRBaseInteractor) has been deprecated. Use OnHoverEntering(HoverEnterEventArgs) instead.")]
    protected virtual void OnHoverEntering(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is initiating the hover.

    Remarks

    OnHoverEntering(XRBaseInteractor) has been deprecated. Use OnHoverEntering(HoverEnterEventArgs) instead.

    See Also
    OnHoverEntered(XRBaseInteractor)

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

    Remarks

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

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    OnHoverExited(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnHoverExited(XRBaseInteractor) has been deprecated. Use OnHoverExited(HoverExitEventArgs) instead.")]
    protected virtual void OnHoverExited(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the hover.

    Remarks

    OnHoverExited(XRBaseInteractor) has been deprecated. Use OnHoverExited(HoverExitEventArgs) instead.

    See Also
    OnHoverEntered(XRBaseInteractor)

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

    Remarks

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

    See Also
    OnHoverExited(HoverExitEventArgs)

    OnHoverExiting(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnHoverExiting(XRBaseInteractor) has been deprecated. Use OnHoverExiting(HoverExitEventArgs) instead.")]
    protected virtual void OnHoverExiting(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the hover.

    Remarks

    OnHoverExiting(XRBaseInteractor) has been deprecated. Use OnHoverExiting(HoverExitEventArgs) instead.

    See Also
    OnHoverExited(XRBaseInteractor)

    OnRegistered(InteractableRegisteredEventArgs)

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

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

    Event data containing the Interaction Manager that registered this Interactable.

    Remarks

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

    See Also
    RegisterInteractable(IXRInteractable)

    OnSelectCanceled(XRBaseInteractor)

    (Deprecated) The XRInteractionManager calls this method while an Interactor selects this Interactable when either is unregistered (such as from being disabled or destroyed) in a second pass.

    Declaration
    [Obsolete("OnSelectCanceled(XRBaseInteractor) has been deprecated. Use OnSelectExited(SelectExitEventArgs) and check for args.isCanceled instead.")]
    protected virtual void OnSelectCanceled(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the selection.

    Remarks

    OnSelectCanceled(XRBaseInteractor) has been deprecated. Use OnSelectExited(SelectExitEventArgs) instead.

    See Also
    OnSelectEntered(XRBaseInteractor)
    OnSelectExited(XRBaseInteractor)
    OnSelectCanceling(XRBaseInteractor)

    OnSelectCanceling(XRBaseInteractor)

    (Deprecated) The XRInteractionManager calls this method while this Interactable is selected by an Interactor right before either is unregistered (such as from being disabled or destroyed) in a first pass.

    Declaration
    [Obsolete("OnSelectCanceling(XRBaseInteractor) has been deprecated. Use OnSelectExiting(SelectExitEventArgs) and check for args.isCanceled instead.")]
    protected virtual void OnSelectCanceling(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the selection.

    Remarks

    OnSelectCanceling(XRBaseInteractor) has been deprecated. Use OnSelectExiting(SelectExitEventArgs) instead.

    See Also
    OnSelectEntered(XRBaseInteractor)
    OnSelectExited(XRBaseInteractor)
    OnSelectCanceled(XRBaseInteractor)

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

    OnSelectEntered(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnSelectEntered(XRBaseInteractor) has been deprecated. Use OnSelectEntered(SelectEnterEventArgs) instead.")]
    protected virtual void OnSelectEntered(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is initiating the selection.

    Remarks

    OnSelectEntered(XRBaseInteractor) has been deprecated. Use OnSelectEntered(SelectEnterEventArgs) instead.

    See Also
    OnSelectExited(XRBaseInteractor)
    OnSelectCanceled(XRBaseInteractor)

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

    OnSelectEntering(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnSelectEntering(XRBaseInteractor) has been deprecated. Use OnSelectEntering(SelectEnterEventArgs) instead.")]
    protected virtual void OnSelectEntering(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is initiating the selection.

    Remarks

    OnSelectEntering(XRBaseInteractor) has been deprecated. Use OnSelectEntering(SelectEnterEventArgs) instead.

    See Also
    OnSelectEntered(XRBaseInteractor)

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

    OnSelectExited(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnSelectExited(XRBaseInteractor) has been deprecated. Use OnSelectExited(SelectExitEventArgs) and check for !args.isCanceled instead.")]
    protected virtual void OnSelectExited(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the selection.

    Remarks

    OnSelectExited(XRBaseInteractor) has been deprecated. Use OnSelectExited(SelectExitEventArgs) instead.

    See Also
    OnSelectEntered(XRBaseInteractor)
    OnSelectCanceled(XRBaseInteractor)

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

    OnSelectExiting(XRBaseInteractor)

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

    Declaration
    [Obsolete("OnSelectExiting(XRBaseInteractor) has been deprecated. Use OnSelectExiting(SelectExitEventArgs) and check for !args.isCanceled instead.")]
    protected virtual void OnSelectExiting(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is ending the selection.

    Remarks

    OnSelectExiting(XRBaseInteractor) has been deprecated. Use OnSelectExiting(SelectExitEventArgs) instead.

    See Also
    OnSelectExited(XRBaseInteractor)

    OnUnregistered(InteractableUnregisteredEventArgs)

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

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

    Event data containing the Interaction Manager that unregistered this Interactable.

    Remarks

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

    See Also
    UnregisterInteractable(IXRInteractable)

    ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)

    The XRInteractionManager calls this method to update the Interactable.

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

    The update phase this is called during.

    Implements
    IXRInteractable.ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
    Remarks

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

    See Also
    XRInteractionUpdateOrder.UpdatePhase
    ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)

    RemoveCustomReticle(IXRInteractor)

    Removes the custom reticle from the Interactor.

    Declaration
    public virtual void RemoveCustomReticle(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    Interactor that is no longer interacting with this Interactable.

    RemoveCustomReticle(XRBaseInteractor)

    (Deprecated) Removes the custom reticle from the Interactor.

    Declaration
    [Obsolete("RemoveCustomReticle(XRBaseInteractor) has been deprecated. Use RemoveCustomReticle(IXRInteractor) instead.")]
    public virtual void RemoveCustomReticle(XRBaseInteractor interactor)
    Parameters
    Type Name Description
    XRBaseInteractor interactor

    Interactor that is no longer interacting with this Interactable.

    Remarks

    RemoveCustomReticle(XRBaseInteractor) has been deprecated. Use RemoveCustomReticle(IXRInteractor) instead.

    Reset()

    See MonoBehaviour.

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

    Events

    registered

    Unity calls the methods in this invocation list when this Interactable is registered with an XRInteractionManager.

    Declaration
    public event Action<InteractableRegisteredEventArgs> registered
    Event Type
    Type Description
    Action<InteractableRegisteredEventArgs>
    Implements
    IXRInteractable.registered
    Remarks

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

    See Also
    interactableRegistered

    unregistered

    Unity calls the methods in this invocation list when this Interactable is unregistered from an XRInteractionManager.

    Declaration
    public event Action<InteractableUnregisteredEventArgs> unregistered
    Event Type
    Type Description
    Action<InteractableUnregisteredEventArgs>
    Implements
    IXRInteractable.unregistered
    Remarks

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

    See Also
    interactableUnregistered

    Explicit Interface Implementations

    IXRActivateInteractable.OnActivated(ActivateEventArgs)

    This method is called when the Interactor begins an activation event on this Interactable.

    Declaration
    void IXRActivateInteractable.OnActivated(ActivateEventArgs args)
    Parameters
    Type Name Description
    ActivateEventArgs args

    Event data containing the Interactor that is sending the activate event.

    Implements
    IXRActivateInteractable.OnActivated(ActivateEventArgs)
    Remarks

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

    See Also
    OnDeactivated(DeactivateEventArgs)

    IXRActivateInteractable.OnDeactivated(DeactivateEventArgs)

    This method is called when the Interactor ends an activation event on this Interactable.

    Declaration
    void IXRActivateInteractable.OnDeactivated(DeactivateEventArgs args)
    Parameters
    Type Name Description
    DeactivateEventArgs args

    Event data containing the Interactor that is sending the deactivate event.

    Implements
    IXRActivateInteractable.OnDeactivated(DeactivateEventArgs)
    Remarks

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

    See Also
    OnActivated(ActivateEventArgs)

    IXRHoverInteractable.IsHoverableBy(IXRHoverInteractor)

    Determines if a given Interactor can hover over this Interactable.

    Declaration
    bool IXRHoverInteractable.IsHoverableBy(IXRHoverInteractor interactor)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    Interactor to check for a valid hover state with.

    Returns
    Type Description
    Boolean

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

    Implements
    IXRHoverInteractable.IsHoverableBy(IXRHoverInteractor)
    See Also
    CanHover(IXRHoverInteractable)

    IXRHoverInteractable.OnHoverEntered(HoverEnterEventArgs)

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

    Declaration
    void IXRHoverInteractable.OnHoverEntered(HoverEnterEventArgs args)
    Parameters
    Type Name Description
    HoverEnterEventArgs args

    Event data containing the Interactor that is initiating the hover.

    Implements
    IXRHoverInteractable.OnHoverEntered(HoverEnterEventArgs)
    Remarks

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

    See Also
    OnHoverExited(HoverExitEventArgs)

    IXRHoverInteractable.OnHoverEntering(HoverEnterEventArgs)

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

    Declaration
    void IXRHoverInteractable.OnHoverEntering(HoverEnterEventArgs args)
    Parameters
    Type Name Description
    HoverEnterEventArgs args

    Event data containing the Interactor that is initiating the hover.

    Implements
    IXRHoverInteractable.OnHoverEntering(HoverEnterEventArgs)
    Remarks

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

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    IXRHoverInteractable.OnHoverExited(HoverExitEventArgs)

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

    Declaration
    void IXRHoverInteractable.OnHoverExited(HoverExitEventArgs args)
    Parameters
    Type Name Description
    HoverExitEventArgs args

    Event data containing the Interactor that is ending the hover.

    Implements
    IXRHoverInteractable.OnHoverExited(HoverExitEventArgs)
    Remarks

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

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    IXRHoverInteractable.OnHoverExiting(HoverExitEventArgs)

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

    Declaration
    void IXRHoverInteractable.OnHoverExiting(HoverExitEventArgs args)
    Parameters
    Type Name Description
    HoverExitEventArgs args

    Event data containing the Interactor that is ending the hover.

    Implements
    IXRHoverInteractable.OnHoverExiting(HoverExitEventArgs)
    Remarks

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

    See Also
    OnHoverExited(HoverExitEventArgs)

    IXRInteractable.OnRegistered(InteractableRegisteredEventArgs)

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

    Declaration
    void IXRInteractable.OnRegistered(InteractableRegisteredEventArgs args)
    Parameters
    Type Name Description
    InteractableRegisteredEventArgs args

    Event data containing the Interaction Manager that registered this Interactable.

    Implements
    IXRInteractable.OnRegistered(InteractableRegisteredEventArgs)
    Remarks

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

    See Also
    RegisterInteractable(IXRInteractable)

    IXRInteractable.OnUnregistered(InteractableUnregisteredEventArgs)

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

    Declaration
    void IXRInteractable.OnUnregistered(InteractableUnregisteredEventArgs args)
    Parameters
    Type Name Description
    InteractableUnregisteredEventArgs args

    Event data containing the Interaction Manager that unregistered this Interactable.

    Implements
    IXRInteractable.OnUnregistered(InteractableUnregisteredEventArgs)
    Remarks

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

    See Also
    UnregisterInteractable(IXRInteractable)

    IXRSelectInteractable.IsSelectableBy(IXRSelectInteractor)

    Determines if a given Interactor can select this Interactable.

    Declaration
    bool IXRSelectInteractable.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.

    Implements
    IXRSelectInteractable.IsSelectableBy(IXRSelectInteractor)
    See Also
    CanSelect(IXRSelectInteractable)

    IXRSelectInteractable.OnSelectEntered(SelectEnterEventArgs)

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

    Declaration
    void IXRSelectInteractable.OnSelectEntered(SelectEnterEventArgs args)
    Parameters
    Type Name Description
    SelectEnterEventArgs args

    Event data containing the Interactor that is initiating the selection.

    Implements
    IXRSelectInteractable.OnSelectEntered(SelectEnterEventArgs)
    Remarks

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

    See Also
    OnSelectExited(SelectExitEventArgs)

    IXRSelectInteractable.OnSelectEntering(SelectEnterEventArgs)

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

    Declaration
    void IXRSelectInteractable.OnSelectEntering(SelectEnterEventArgs args)
    Parameters
    Type Name Description
    SelectEnterEventArgs args

    Event data containing the Interactor that is initiating the selection.

    Implements
    IXRSelectInteractable.OnSelectEntering(SelectEnterEventArgs)
    Remarks

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

    See Also
    OnSelectEntered(SelectEnterEventArgs)

    IXRSelectInteractable.OnSelectExited(SelectExitEventArgs)

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

    Declaration
    void IXRSelectInteractable.OnSelectExited(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactor that is ending the selection.

    Implements
    IXRSelectInteractable.OnSelectExited(SelectExitEventArgs)
    Remarks

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

    See Also
    OnSelectEntered(SelectEnterEventArgs)

    IXRSelectInteractable.OnSelectExiting(SelectExitEventArgs)

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

    Declaration
    void IXRSelectInteractable.OnSelectExiting(SelectExitEventArgs args)
    Parameters
    Type Name Description
    SelectExitEventArgs args

    Event data containing the Interactor that is ending the selection.

    Implements
    IXRSelectInteractable.OnSelectExiting(SelectExitEventArgs)
    Remarks

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

    See Also
    OnSelectExited(SelectExitEventArgs)

    Extension Methods

    XRHoverInteractableExtensions.GetOldestInteractorHovering(IXRHoverInteractable)
    XRSelectInteractableExtensions.GetOldestInteractorSelecting(IXRSelectInteractable)
    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