docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRBaseInteractable

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

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseInteractable
    XRGrabInteractable
    XRSimpleInteractable
    ClimbInteractable
    BaseTeleportationInteractable
    Implements
    IXRActivateInteractable
    IXRHoverInteractable
    IXRSelectInteractable
    IXRFocusInteractable
    IXRInteractionStrengthInteractable
    IXRInteractable
    IXROverridesGazeAutoSelect
    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.Interactables
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
    [SelectionBase]
    [DefaultExecutionOrder(-98)]
    public abstract class XRBaseInteractable : MonoBehaviour, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRFocusInteractable, IXRInteractionStrengthInteractable, IXRInteractable, IXROverridesGazeAutoSelect

    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
    Remarks

    Not to be confused with activating or deactivating a GameObject with SetActive(bool). 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

    allowGazeAssistance

    Enables gaze assistance with this interactable.

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

    allowGazeInteraction

    Enables interaction with XRGazeInteractor.

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

    allowGazeSelect

    Enables XRGazeInteractor to select this XRBaseInteractable.

    Declaration
    public bool allowGazeSelect { get; set; }
    Property Value
    Type Description
    bool
    See Also
    hoverToSelect

    canFocus

    Indicates whether this Interactable can be focused.

    Declaration
    public bool canFocus { get; }
    Property Value
    Type Description
    bool

    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>

    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
    Remarks

    Not to be confused with activating or deactivating a GameObject with SetActive(bool). 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

    firstFocusEntered

    The event that is called only when the first Interaction Group gains focus on this Interactable as the sole focusing Interactor. Subsequent Interactors that gain focus will not cause this event to be invoked as long as any others are still focusing.

    Declaration
    public FocusEnterEvent firstFocusEntered { get; set; }
    Property Value
    Type Description
    FocusEnterEvent
    Remarks

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

    See Also
    lastFocusExited
    focusEntered

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

    firstInteractionGroupFocusing

    (Read Only) The first interaction group that is focused on this interactable since not being focused. The group may not currently be focusing this interactable, which would be the case when it released while multiple groups were focusing this interactable.

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

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

    focusEntered

    The event that is called when an Interaction group gains focus on this Interactable.

    Declaration
    public FocusEnterEvent focusEntered { get; set; }
    Property Value
    Type Description
    FocusEnterEvent
    Remarks

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

    See Also
    focusExited

    focusExited

    The event that is called when an Interaction group loses focus on this Interactable.

    Declaration
    public FocusExitEvent focusExited { get; set; }
    Property Value
    Type Description
    FocusExitEvent
    Remarks

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

    See Also
    focusEntered

    focusMode

    Indicates the focus policy of an Interactable.

    Declaration
    public InteractableFocusMode focusMode { get; set; }
    Property Value
    Type Description
    InteractableFocusMode
    See Also
    InteractableFocusMode

    gazeTimeToSelect

    Number of seconds for which an XRGazeInteractor must hover over this interactable to select it if hoverToSelect is enabled.

    Declaration
    public float gazeTimeToSelect { get; set; }
    Property Value
    Type Description
    float
    See Also
    overrideGazeTimeToSelect
    hoverTimeToSelect

    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
    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
    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 Interactable.

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

    interactionGroupsFocusing

    (Read Only) The list of Interaction groups currently focusing on this Interactable (may be empty). Only the group that directly contains the interactor that caused the focus will be contained in this list, meaning if the focus group is nested within another group, that parent group will not also be included.

    Declaration
    public List<IXRInteractionGroup> interactionGroupsFocusing { get; }
    Property Value
    Type Description
    List<IXRInteractionGroup>
    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
    isFocused

    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
    See Also
    interactionLayers
    IsHoverableBy(IXRHoverInteractor)
    IsSelectableBy(IXRSelectInteractor)
    interactionLayers

    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

    interactionStrengthFilters

    The list of interaction strength filters in this object. Used to modify the default interaction strength of an Interactor relative to this Interactable. This is useful for interactables that can be poked to report the depth of the poke interactor as a percentage while the poke interactor is hovering over this object.

    Declaration
    public IXRFilterList<IXRInteractionStrengthFilter> interactionStrengthFilters { get; }
    Property Value
    Type Description
    IXRFilterList<IXRInteractionStrengthFilter>
    Remarks

    While processing interaction strength 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
    ProcessInteractionStrengthFilters(IXRInteractor, float)

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

    isFocused

    (Read Only) Indicates whether this interactable is currently being focused by any interaction group.

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

    In other words, returns whether interactionGroupsFocusing contains any interaction groups.

    Examples
      interactionGroupsFocusing.Count > 0
    
    See Also
    interactionGroupsFocusing

    isHovered

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

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

    In other words, returns whether interactorsHovering contains any interactors.

    Examples
      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
    bool
    Remarks

    In other words, returns whether interactorsSelecting contains any interactors.

    Examples
      interactorsSelecting.Count > 0
    
    See Also
    interactorsSelecting
    hasSelection

    largestInteractionStrength

    The largest interaction strength value of all interactors hovering or selecting this interactable.

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

    lastFocusExited

    The event that is called only when the last remaining focused Interaction group loses focus on this Interactable.

    Declaration
    public FocusExitEvent lastFocusExited { get; set; }
    Property Value
    Type Description
    FocusExitEvent
    Remarks

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

    See Also
    firstFocusEntered
    focusExited

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

    overrideGazeTimeToSelect

    Enables this interactable to override the hoverTimeToSelect on an XRGazeInteractor.

    Declaration
    public bool overrideGazeTimeToSelect { get; set; }
    Property Value
    Type Description
    bool
    See Also
    gazeTimeToSelect
    hoverToSelect

    overrideTimeToAutoDeselectGaze

    Enables this interactable to override the timeToAutoDeselect on an XRGazeInteractor.

    Declaration
    public bool overrideTimeToAutoDeselectGaze { get; set; }
    Property Value
    Type Description
    bool
    See Also
    timeToAutoDeselectGaze
    autoDeselect

    selectEntered

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

    Declaration
    public SelectExitEvent selectExited { get; set; }
    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

    selectFilters

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

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

    selectMode

    Indicates the selection policy of an Interactable.

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

    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

    startingInteractionStrengthFilters

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

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

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

    See Also
    interactionStrengthFilters

    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

    timeToAutoDeselectGaze

    Number of seconds that the interactable will remain selected by an XRGazeInteractor before being automatically deselected if overrideTimeToAutoDeselectGaze is true.

    Declaration
    public float timeToAutoDeselectGaze { get; set; }
    Property Value
    Type Description
    float
    See Also
    overrideTimeToAutoDeselectGaze

    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.

    Remarks

    If the custom reticle has an IXRInteractableCustomReticle component, this will call OnReticleAttached(XRBaseInteractable, IXRCustomReticleProvider) on it.

    See Also
    RemoveCustomReticle(IXRInteractor)

    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.

    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.

    Remarks

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

    See Also
    GetAttachTransform(IXRInteractable)

    GetCustomReticle(IXRInteractor)

    Looks for the current custom reticle that is attached based on a specific Interactor.

    Declaration
    public virtual GameObject GetCustomReticle(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    Interactor that is interacting with this Interactable.

    Returns
    Type Description
    GameObject

    Returns GameObject that represents the attached custom reticle.

    See Also
    AttachCustomReticle(IXRInteractor)

    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
    float

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

    Remarks

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

    GetInteractionStrength(IXRInteractor)

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

    Declaration
    public float GetInteractionStrength(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    The specific interactor to get the interaction strength between.

    Returns
    Type Description
    float

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

    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.

    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
    bool

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

    See Also
    CanHover(IXRHoverInteractable)

    IsHovered(IXRHoverInteractor)

    Determines whether this Interactable is currently being hovered by the Interactor.

    Declaration
    public bool IsHovered(IXRHoverInteractor interactor)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    Interactor to check.

    Returns
    Type Description
    bool

    Returns true if this Interactable is currently being hovered by the Interactor. Otherwise, returns false.

    Remarks

    In other words, returns whether interactorsHovering contains interactor.

    See Also
    interactorsHovering

    IsHovered(IXRInteractor)

    Determines whether this Interactable is currently being hovered by the Interactor.

    Declaration
    protected bool IsHovered(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    Interactor to check.

    Returns
    Type Description
    bool

    Returns true if this Interactable is currently being hovered by the Interactor. Otherwise, returns false.

    Remarks

    In other words, returns whether interactorsHovering contains interactor.

    See Also
    interactorsHovering
    IsHovered(IXRHoverInteractor)

    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
    bool

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

    See Also
    CanSelect(IXRSelectInteractable)

    IsSelected(IXRInteractor)

    Determines whether this Interactable is currently being selected by the Interactor.

    Declaration
    protected bool IsSelected(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    Interactor to check.

    Returns
    Type Description
    bool

    Returns true if this Interactable is currently being selected by the Interactor. Otherwise, returns false.

    Remarks

    In other words, returns whether interactorsSelecting contains interactor.

    See Also
    interactorsSelecting
    IsSelected(IXRSelectInteractor)

    IsSelected(IXRSelectInteractor)

    Determines whether this Interactable is currently being selected by the Interactor.

    Declaration
    public bool IsSelected(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    Interactor to check.

    Returns
    Type Description
    bool

    Returns true if this Interactable is currently being selected by the Interactor. Otherwise, returns false.

    Remarks

    In other words, returns whether interactorsSelecting contains interactor.

    See Also
    interactorsSelecting

    OnActivated(ActivateEventArgs)

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

    OnDeactivated(DeactivateEventArgs)

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

    OnFocusEntered(FocusEnterEventArgs)

    The XRInteractionManager calls this method when the Interaction group first gains focus of an Interactable in a second pass.

    Declaration
    protected virtual void OnFocusEntered(FocusEnterEventArgs args)
    Parameters
    Type Name Description
    FocusEnterEventArgs args

    Event data containing the Interaction group that is initiating the focus.

    Remarks

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

    See Also
    OnFocusExited(FocusExitEventArgs)

    OnFocusEntering(FocusEnterEventArgs)

    The XRInteractionManager calls this method right before the Interaction group first gains focus of an Interactable in a first pass.

    Declaration
    protected virtual void OnFocusEntering(FocusEnterEventArgs args)
    Parameters
    Type Name Description
    FocusEnterEventArgs args

    Event data containing the Interaction group that is initiating focus.

    Remarks

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

    See Also
    OnFocusEntered(FocusEnterEventArgs)

    OnFocusExited(FocusExitEventArgs)

    The XRInteractionManager calls this method when the Interaction group loses focus of an Interactable in a second pass.

    Declaration
    protected virtual void OnFocusExited(FocusExitEventArgs args)
    Parameters
    Type Name Description
    FocusExitEventArgs args

    Event data containing the Interaction group that is losing focus.

    Remarks

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

    See Also
    OnFocusEntered(FocusEnterEventArgs)

    OnFocusExiting(FocusExitEventArgs)

    The XRInteractionManager calls this method right before the Interaction group loses focus of an Interactable in a first pass.

    Declaration
    protected virtual void OnFocusExiting(FocusExitEventArgs args)
    Parameters
    Type Name Description
    FocusExitEventArgs args

    Event data containing the Interaction group that is losing focus.

    Remarks

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

    See Also
    OnFocusExited(FocusExitEventArgs)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    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)

    ProcessHoverFilters(IXRHoverInteractor)

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

    Declaration
    protected bool ProcessHoverFilters(IXRHoverInteractor interactor)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor 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.

    ProcessInteractable(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.

    Remarks

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

    See Also
    XRInteractionUpdateOrder.UpdatePhase
    ProcessInteractor(UpdatePhase)

    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(IXRInteractor)
    ProcessInteractionStrength(UpdatePhase)

    ProcessInteractionStrengthFilters(IXRInteractor, float)

    Returns the processing value of the interaction strength filters in interactionStrengthFilters for the given Interactor and this Interactable.

    Declaration
    protected float ProcessInteractionStrengthFilters(IXRInteractor interactor, float interactionStrength)
    Parameters
    Type Name Description
    IXRInteractor interactor

    The Interactor to process by the interaction strength filters.

    float interactionStrength

    The interaction strength before processing.

    Returns
    Type Description
    float

    Returns the modified interaction strength that is the result of passing the interaction strength through each filter.

    ProcessSelectFilters(IXRSelectInteractor)

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

    Declaration
    protected bool ProcessSelectFilters(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    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.

    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.

    Remarks

    If the custom reticle has an IXRInteractableCustomReticle component, this will call OnReticleDetaching() on it.

    See Also
    AttachCustomReticle(IXRInteractor)

    Reset()

    See MonoBehaviour.

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

    Events

    registered

    Calls the methods in its invocation list when this Interactable is registered with an XRInteractionManager.

    Declaration
    public event Action<InteractableRegisteredEventArgs> registered
    Event Type
    Type Description
    Action<InteractableRegisteredEventArgs>
    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

    Calls the methods in its invocation list when this Interactable is unregistered from an XRInteractionManager.

    Declaration
    public event Action<InteractableUnregisteredEventArgs> unregistered
    Event Type
    Type Description
    Action<InteractableUnregisteredEventArgs>
    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

    Implements

    IXRActivateInteractable
    IXRHoverInteractable
    IXRSelectInteractable
    IXRFocusInteractable
    IXRInteractionStrengthInteractable
    IXRInteractable
    IXROverridesGazeAutoSelect

    Extension Methods

    XRFocusInteractableExtensions.GetOldestInteractorFocusing(IXRFocusInteractable)
    XRHoverInteractableExtensions.GetOldestInteractorHovering(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByLeft(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByRight(IXRHoverInteractable)
    XRSelectInteractableExtensions.GetOldestInteractorSelecting(IXRSelectInteractable)
    XRSelectInteractableExtensions.IsSelectedByLeft(IXRSelectInteractable)
    XRSelectInteractableExtensions.IsSelectedByRight(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)