docs.unity3d.com
    Show / Hide Table of Contents

    Class XRInteractionManager

    The Interaction Manager acts as an intermediary between Interactors and Interactables. It is possible to have multiple Interaction Managers, each with their own valid set of Interactors and Interactables. Upon being enabled, both Interactors and Interactables register themselves with a valid Interaction Manager (if a specific one has not already been assigned in the inspector). The loaded scenes must have at least one Interaction Manager for Interactors and Interactables to be able to communicate.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRInteractionManager
    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.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, Boolean)
    Component.GetComponentInParent(Type)
    UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
    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
    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.FindObjectsOfType(Type, Boolean)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    UnityEngine.Object.FindFirstObjectByType<T>()
    UnityEngine.Object.FindAnyObjectByType<T>()
    UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
    UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    [AddComponentMenu("XR/XR Interaction Manager", 11)]
    [DisallowMultipleComponent]
    [DefaultExecutionOrder(-105)]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.3/api/UnityEngine.XR.Interaction.Toolkit.XRInteractionManager.html")]
    public class XRInteractionManager : MonoBehaviour
    Remarks

    Many of the methods on the Interactors and Interactables are designed to be called by this Interaction Manager rather than being called directly in order to maintain consistency between both targets of an interaction event.

    Properties

    hoverFilters

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

    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, Int32) in this list will throw an exception when this list is being processed.

    See Also
    ProcessHoverFilters(IXRHoverInteractor, IXRHoverInteractable)

    selectFilters

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

    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. Theses changes are buffered and applied when the processing is finished. Calling MoveTo(T, Int32) in this list will throw an exception when this list is being processed.

    See Also
    ProcessSelectFilters(IXRSelectInteractor, IXRSelectInteractable)

    startingHoverFilters

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

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

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

    See Also
    hoverFilters

    startingSelectFilters

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

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

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

    See Also
    selectFilters

    Methods

    Awake()

    See MonoBehaviour.

    Declaration
    protected virtual void Awake()

    CancelInteractableHover(IXRHoverInteractable)

    Automatically called when an Interactable is unregistered to cancel the hover state of the Interactable if necessary.

    Declaration
    public virtual void CancelInteractableHover(IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractable interactable

    The Interactable to potentially exit its hover state due to cancellation.

    CancelInteractableSelection(IXRSelectInteractable)

    Automatically called when an Interactable is unregistered to cancel the selection of the Interactable if necessary.

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

    The Interactable to potentially exit its selection state due to cancellation.

    CancelInteractorHover(IXRHoverInteractor)

    Automatically called when an Interactor is unregistered to cancel the hover state of the Interactor if necessary.

    Declaration
    public virtual void CancelInteractorHover(IXRHoverInteractor interactor)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor to potentially exit its hover state due to cancellation.

    CancelInteractorSelection(IXRSelectInteractor)

    Automatically called when an Interactor is unregistered to cancel the selection of the Interactor if necessary.

    Declaration
    public virtual void CancelInteractorSelection(IXRSelectInteractor interactor)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor to potentially exit its selection state due to cancellation.

    CanHover(IXRHoverInteractor, IXRHoverInteractable)

    Whether the given Interactor can hover the given Interactable. You can extend this method to add global hover validations by code.

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

    The Interactor to check.

    IXRHoverInteractable interactable

    The Interactable to check.

    Returns
    Type Description
    Boolean

    Returns whether the given Interactor can hover the given Interactable.

    Remarks

    You can also extend the global hover validations without needing to create a derived class by adding hover filters to this object (see startingHoverFilters and hoverFilters).

    See Also
    IsHoverPossible(IXRHoverInteractor, IXRHoverInteractable)

    CanSelect(IXRSelectInteractor, IXRSelectInteractable)

    Whether the given Interactor can select the given Interactable. You can extend this method to add global select validations by code.

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

    The Interactor to check.

    IXRSelectInteractable interactable

    The Interactable to check.

    Returns
    Type Description
    Boolean

    Returns whether the given Interactor can select the given Interactable.

    Remarks

    You can also extend the global select validations without needing to create a derived class by adding select filters to this object (see startingSelectFilters and selectFilters).

    See Also
    IsSelectPossible(IXRSelectInteractor, IXRSelectInteractable)

    ClearInteractorHover(IXRHoverInteractor, List<IXRInteractable>)

    Automatically called each frame during Update to clear the hover state of the Interactor if necessary due to current conditions.

    Declaration
    protected virtual void ClearInteractorHover(IXRHoverInteractor interactor, List<IXRInteractable> validTargets)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor to potentially exit its hover state.

    List<IXRInteractable> validTargets

    The list of interactables that this Interactor could possibly interact with this frame.

    See Also
    ClearInteractorSelection(IXRSelectInteractor, List<IXRInteractable>)

    ClearInteractorSelection(IXRSelectInteractor, List<IXRInteractable>)

    Automatically called each frame during Update to clear the selection of the Interactor if necessary due to current conditions.

    Declaration
    protected virtual void ClearInteractorSelection(IXRSelectInteractor interactor, List<IXRInteractable> validTargets)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor to potentially exit its selection state.

    List<IXRInteractable> validTargets

    The list of interactables that this Interactor could possibly interact with this frame.

    See Also
    ClearInteractorHover(IXRHoverInteractor, List<IXRInteractable>)

    FixedUpdate()

    See MonoBehaviour.

    Declaration
    protected virtual void FixedUpdate()

    GetRegisteredInteractables(List<IXRInteractable>)

    Returns all registered Interactables into List results.

    Declaration
    public void GetRegisteredInteractables(List<IXRInteractable> results)
    Parameters
    Type Name Description
    List<IXRInteractable> results

    List to receive registered Interactables.

    Remarks

    This method populates the list with the registered Interactables at the time the method is called. It is not a live view, meaning Interactables registered or unregistered afterward will not be reflected in the results of this method. Clears results before adding to it.

    See Also
    GetRegisteredInteractors(List<IXRInteractor>)

    GetRegisteredInteractionGroups(List<IXRInteractionGroup>)

    Returns all registered Interaction Groups into List results.

    Declaration
    public void GetRegisteredInteractionGroups(List<IXRInteractionGroup> results)
    Parameters
    Type Name Description
    List<IXRInteractionGroup> results

    List to receive registered Interaction Groups.

    Remarks

    This method populates the list with the registered Interaction Groups at the time the method is called. It is not a live view, meaning Interaction Groups registered or unregistered afterward will not be reflected in the results of this method. Clears results before adding to it.

    GetRegisteredInteractors(List<IXRInteractor>)

    Returns all registered Interactors into List results.

    Declaration
    public void GetRegisteredInteractors(List<IXRInteractor> results)
    Parameters
    Type Name Description
    List<IXRInteractor> results

    List to receive registered Interactors.

    Remarks

    This method populates the list with the registered Interactors at the time the method is called. It is not a live view, meaning Interactors registered or unregistered afterward will not be reflected in the results of this method. Clears results before adding to it.

    See Also
    GetRegisteredInteractables(List<IXRInteractable>)

    GetValidTargets(IXRInteractor, List<IXRInteractable>)

    Retrieves the list of Interactables that the given Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first), and will only contain Interactables that are registered with this Interaction Manager.

    Declaration
    public void GetValidTargets(IXRInteractor interactor, List<IXRInteractable> targets)
    Parameters
    Type Name Description
    IXRInteractor interactor

    The Interactor to get valid targets for.

    List<IXRInteractable> targets

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

    Remarks

    Unity expects the interactor's implementation of GetValidTargets(List<IXRInteractable>) to clear targets before adding to it.

    See Also
    GetValidTargets(List<IXRInteractable>)

    HasInteractionLayerOverlap(IXRInteractor, IXRInteractable)

    Determines whether the Interactor and Interactable share at least one interaction layer between their Interaction Layer Masks.

    Declaration
    protected static bool HasInteractionLayerOverlap(IXRInteractor interactor, IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractor interactor

    The Interactor to check.

    IXRInteractable interactable

    The Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if the Interactor and Interactable share at least one interaction layer. Otherwise, returns false.

    See Also
    interactionLayers
    interactionLayers

    HoverCancel(IXRHoverInteractor, IXRHoverInteractable)

    Initiates ending hovering of an Interactable by an Interactor due to cancellation, such as from either being unregistered due to being disabled or destroyed.

    Declaration
    public virtual void HoverCancel(IXRHoverInteractor interactor, IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor that is no longer hovering.

    IXRHoverInteractable interactable

    The Interactable that is no longer being hovered over.

    HoverEnter(IXRHoverInteractor, IXRHoverInteractable)

    Initiates hovering of an Interactable by an Interactor.

    Declaration
    public virtual void HoverEnter(IXRHoverInteractor interactor, IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor that is hovering.

    IXRHoverInteractable interactable

    The Interactable being hovered over.

    HoverEnter(IXRHoverInteractor, IXRHoverInteractable, HoverEnterEventArgs)

    Initiates hovering of an Interactable by an Interactor, passing the given args.

    Declaration
    protected virtual void HoverEnter(IXRHoverInteractor interactor, IXRHoverInteractable interactable, HoverEnterEventArgs args)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor that is hovering.

    IXRHoverInteractable interactable

    The Interactable being hovered over.

    HoverEnterEventArgs args

    Event data containing the Interactor and Interactable involved in the event.

    Remarks

    The interactor and interactable are notified immediately without waiting for a previous call to finish in the case when this method is called again in a nested way. This means that if this method is called during the handling of the first event, the second will start and finish before the first event finishes calling all methods in the sequence to notify of the first event.

    HoverExit(IXRHoverInteractor, IXRHoverInteractable)

    Initiates ending hovering of an Interactable by an Interactor.

    Declaration
    public virtual void HoverExit(IXRHoverInteractor interactor, IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor that is no longer hovering.

    IXRHoverInteractable interactable

    The Interactable that is no longer being hovered over.

    HoverExit(IXRHoverInteractor, IXRHoverInteractable, HoverExitEventArgs)

    Initiates ending hovering of an Interactable by an Interactor, passing the given args.

    Declaration
    protected virtual void HoverExit(IXRHoverInteractor interactor, IXRHoverInteractable interactable, HoverExitEventArgs args)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor that is no longer hovering.

    IXRHoverInteractable interactable

    The Interactable that is no longer being hovered over.

    HoverExitEventArgs args

    Event data containing the Interactor and Interactable involved in the event.

    Remarks

    The interactor and interactable are notified immediately without waiting for a previous call to finish in the case when this method is called again in a nested way. This means that if this method is called during the handling of the first event, the second will start and finish before the first event finishes calling all methods in the sequence to notify of the first event.

    InteractorHoverValidTargets(IXRHoverInteractor, List<IXRInteractable>)

    Automatically called each frame during Update to enter the hover state of the Interactor if necessary due to current conditions.

    Declaration
    protected virtual void InteractorHoverValidTargets(IXRHoverInteractor interactor, List<IXRInteractable> validTargets)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor to potentially enter its hover state.

    List<IXRInteractable> validTargets

    The list of interactables that this Interactor could possibly interact with this frame.

    See Also
    InteractorSelectValidTargets(IXRSelectInteractor, List<IXRInteractable>)

    InteractorSelectValidTargets(IXRSelectInteractor, List<IXRInteractable>)

    Automatically called each frame during Update to enter the selection state of the Interactor if necessary due to current conditions.

    Declaration
    protected virtual void InteractorSelectValidTargets(IXRSelectInteractor interactor, List<IXRInteractable> validTargets)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor to potentially enter its selection state.

    List<IXRInteractable> validTargets

    The list of interactables that this Interactor could possibly interact with this frame.

    Remarks

    If the Interactor implements IXRTargetPriorityInteractor and is configured to monitor Targets, this method will update its Targets For Selection property.

    See Also
    InteractorHoverValidTargets(IXRHoverInteractor, List<IXRInteractable>)

    IsHighestPriorityTarget(IXRSelectInteractable, List<IXRTargetPriorityInteractor>)

    Gets whether the given Interactable is the highest priority candidate for selection in this frame, useful for custom feedback. Only IXRTargetPriorityInteractors that are configured to monitor Targets will be considered.

    Declaration
    public bool IsHighestPriorityTarget(IXRSelectInteractable target, List<IXRTargetPriorityInteractor> interactors = null)
    Parameters
    Type Name Description
    IXRSelectInteractable target

    The Interactable to check if it's the highest priority candidate for selection.

    List<IXRTargetPriorityInteractor> interactors

    (Optional) Returns the list of Interactors where the given Interactable has the highest priority for selection.

    Returns
    Type Description
    Boolean

    Returns true if the given Interactable is the highest priority candidate for selection. Otherwise, returns false.

    Remarks

    Clears interactors before adding to it.

    IsHoverPossible(IXRHoverInteractor, IXRHoverInteractable)

    Whether the given Interactor would be able to hover the given Interactable if the Interactor were in a state where it could hover.

    Declaration
    public bool IsHoverPossible(IXRHoverInteractor interactor, IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    The Interactor to check.

    IXRHoverInteractable interactable

    The Interactable to check.

    Returns
    Type Description
    Boolean

    Returns whether the given Interactor would be able to hover the given Interactable if the Interactor were in a state where it could hover.

    See Also
    CanHover(IXRHoverInteractor, IXRHoverInteractable)

    IsRegistered(IXRInteractable)

    Checks whether the interactable is registered with this Interaction Manager.

    Declaration
    public bool IsRegistered(IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractable interactable

    The Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if registered. Otherwise, returns false.

    See Also
    RegisterInteractable(IXRInteractable)

    IsRegistered(IXRInteractionGroup)

    Checks whether the interactionGroup is registered with this Interaction Manager.

    Declaration
    public bool IsRegistered(IXRInteractionGroup interactionGroup)
    Parameters
    Type Name Description
    IXRInteractionGroup interactionGroup

    The Interaction Group to check.

    Returns
    Type Description
    Boolean

    Returns true if registered. Otherwise, returns false.

    See Also
    RegisterInteractionGroup(IXRInteractionGroup)

    IsRegistered(IXRInteractor)

    Checks whether the interactor is registered with this Interaction Manager.

    Declaration
    public bool IsRegistered(IXRInteractor interactor)
    Parameters
    Type Name Description
    IXRInteractor interactor

    The Interactor to check.

    Returns
    Type Description
    Boolean

    Returns true if registered. Otherwise, returns false.

    See Also
    RegisterInteractor(IXRInteractor)

    IsSelectPossible(IXRSelectInteractor, IXRSelectInteractable)

    Whether the given Interactor would be able to select the given Interactable if the Interactor were in a state where it could select.

    Declaration
    public bool IsSelectPossible(IXRSelectInteractor interactor, IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor to check.

    IXRSelectInteractable interactable

    The Interactable to check.

    Returns
    Type Description
    Boolean

    Returns whether the given Interactor would be able to select the given Interactable if the Interactor were in a state where it could select.

    See Also
    CanSelect(IXRSelectInteractor, IXRSelectInteractable)

    LateUpdate()

    See MonoBehaviour.

    Declaration
    protected virtual void LateUpdate()

    OnBeforeRender()

    Delegate method used to register for "Just Before Render" input updates for VR devices.

    Declaration
    [BeforeRenderOrder(100)]
    protected virtual void OnBeforeRender()
    See Also
    Application

    OnDisable()

    See MonoBehaviour.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    See MonoBehaviour.

    Declaration
    protected virtual void OnEnable()

    OnRegistered(InteractableRegisteredEventArgs)

    Automatically called when an Interactable is registered with this Interaction Manager. Notifies the Interactable, passing the given args.

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

    Event data containing the registered Interactable.

    Remarks

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

    See Also
    RegisterInteractable(IXRInteractable)

    OnRegistered(InteractionGroupRegisteredEventArgs)

    Automatically called when an Interaction Group is registered with this Interaction Manager. Notifies the Interaction Group, passing the given args.

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

    Event data containing the registered Interaction Group.

    Remarks

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

    See Also
    RegisterInteractionGroup(IXRInteractionGroup)

    OnRegistered(InteractorRegisteredEventArgs)

    Automatically called when an Interactor is registered with this Interaction Manager. Notifies the Interactor, passing the given args.

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

    Event data containing the registered Interactor.

    Remarks

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

    See Also
    RegisterInteractor(IXRInteractor)

    OnUnregistered(InteractableUnregisteredEventArgs)

    Automatically called when an Interactable is unregistered from this Interaction Manager. Notifies the Interactable, passing the given args.

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

    Event data containing the unregistered Interactable.

    Remarks

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

    See Also
    UnregisterInteractable(IXRInteractable)

    OnUnregistered(InteractionGroupUnregisteredEventArgs)

    Automatically called when an Interaction Group is unregistered from this Interaction Manager. Notifies the Interaction Group, passing the given args.

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

    Event data containing the unregistered Interaction Group.

    Remarks

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

    See Also
    UnregisterInteractionGroup(IXRInteractionGroup)

    OnUnregistered(InteractorUnregisteredEventArgs)

    Automatically called when an Interactor is unregistered from this Interaction Manager. Notifies the Interactor, passing the given args.

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

    Event data containing the unregistered Interactor.

    Remarks

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

    See Also
    UnregisterInteractor(IXRInteractor)

    PreprocessInteractors(XRInteractionUpdateOrder.UpdatePhase)

    Automatically called each frame to preprocess all interactors registered with this manager.

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

    The update phase.

    Remarks

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

    See Also
    PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    XRInteractionUpdateOrder.UpdatePhase

    ProcessHoverFilters(IXRHoverInteractor, IXRHoverInteractable)

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

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

    The Interactor to be validated by the hover filters.

    IXRHoverInteractable interactable

    The Interactable to be validated by the hover filters.

    Returns
    Type Description
    Boolean

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

    ProcessInteractables(XRInteractionUpdateOrder.UpdatePhase)

    Automatically called each frame to process all interactables registered with this manager.

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

    The update phase.

    Remarks

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

    See Also
    ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
    XRInteractionUpdateOrder.UpdatePhase

    ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase)

    Automatically called each frame to process interaction strength of interactables and interactors registered with this manager.

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

    The update phase.

    See Also
    ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase)
    ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase)
    XRInteractionUpdateOrder.UpdatePhase

    ProcessInteractors(XRInteractionUpdateOrder.UpdatePhase)

    Automatically called each frame to process all interactors registered with this manager.

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

    The update phase.

    Remarks

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

    See Also
    PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    XRInteractionUpdateOrder.UpdatePhase

    ProcessSelectFilters(IXRSelectInteractor, IXRSelectInteractable)

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

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

    The Interactor to be validated by the select filters.

    IXRSelectInteractable interactable

    The Interactable to be validated by the select filters.

    Returns
    Type Description
    Boolean

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

    RegisterInteractable(IXRInteractable)

    Registers a new Interactable to be processed.

    Declaration
    public virtual void RegisterInteractable(IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractable interactable

    The Interactable to be registered.

    RegisterInteractionGroup(IXRInteractionGroup)

    Registers a new Interaction Group to be processed.

    Declaration
    public virtual void RegisterInteractionGroup(IXRInteractionGroup interactionGroup)
    Parameters
    Type Name Description
    IXRInteractionGroup interactionGroup

    The Interaction Group to be registered.

    RegisterInteractor(IXRInteractor)

    Registers a new Interactor to be processed.

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

    The Interactor to be registered.

    RegisterSnapVolume(XRInteractableSnapVolume)

    Registers a new snap volume to associate the snap collider and interactable.

    Declaration
    public void RegisterSnapVolume(XRInteractableSnapVolume snapVolume)
    Parameters
    Type Name Description
    XRInteractableSnapVolume snapVolume

    The snap volume to be registered.

    See Also
    UnregisterSnapVolume(XRInteractableSnapVolume)

    ResolveExistingSelect(IXRSelectInteractor, IXRSelectInteractable)

    Automatically called when selection of an Interactable by an Interactor is initiated and the Interactable is already selected.

    Declaration
    protected virtual bool ResolveExistingSelect(IXRSelectInteractor interactor, IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor that is selecting.

    IXRSelectInteractable interactable

    The Interactable being selected.

    Returns
    Type Description
    Boolean

    Returns true if the existing selection was successfully resolved and selection should continue. Otherwise, returns false if the select should be ignored.

    See Also
    SelectEnter(IXRSelectInteractor, IXRSelectInteractable)

    SelectCancel(IXRSelectInteractor, IXRSelectInteractable)

    Initiates ending selection of an Interactable by an Interactor due to cancellation, such as from either being unregistered due to being disabled or destroyed.

    Declaration
    public virtual void SelectCancel(IXRSelectInteractor interactor, IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor that is no longer selecting.

    IXRSelectInteractable interactable

    The Interactable that is no longer being selected.

    SelectEnter(IXRSelectInteractor, IXRSelectInteractable)

    Initiates selection of an Interactable by an Interactor. This method may first result in other interaction events such as causing the Interactable to first exit being selected.

    Declaration
    public virtual void SelectEnter(IXRSelectInteractor interactor, IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor that is selecting.

    IXRSelectInteractable interactable

    The Interactable being selected.

    Remarks

    This attempt may be ignored depending on the selection policy of the Interactor and/or the Interactable.

    SelectEnter(IXRSelectInteractor, IXRSelectInteractable, SelectEnterEventArgs)

    Initiates selection of an Interactable by an Interactor, passing the given args.

    Declaration
    protected virtual void SelectEnter(IXRSelectInteractor interactor, IXRSelectInteractable interactable, SelectEnterEventArgs args)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor that is selecting.

    IXRSelectInteractable interactable

    The Interactable being selected.

    SelectEnterEventArgs args

    Event data containing the Interactor and Interactable involved in the event.

    Remarks

    The interactor and interactable are notified immediately without waiting for a previous call to finish in the case when this method is called again in a nested way. This means that if this method is called during the handling of the first event, the second will start and finish before the first event finishes calling all methods in the sequence to notify of the first event.

    SelectExit(IXRSelectInteractor, IXRSelectInteractable)

    Initiates ending selection of an Interactable by an Interactor.

    Declaration
    public virtual void SelectExit(IXRSelectInteractor interactor, IXRSelectInteractable interactable)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor that is no longer selecting.

    IXRSelectInteractable interactable

    The Interactable that is no longer being selected.

    SelectExit(IXRSelectInteractor, IXRSelectInteractable, SelectExitEventArgs)

    Initiates ending selection of an Interactable by an Interactor, passing the given args.

    Declaration
    protected virtual void SelectExit(IXRSelectInteractor interactor, IXRSelectInteractable interactable, SelectExitEventArgs args)
    Parameters
    Type Name Description
    IXRSelectInteractor interactor

    The Interactor that is no longer selecting.

    IXRSelectInteractable interactable

    The Interactable that is no longer being selected.

    SelectExitEventArgs args

    Event data containing the Interactor and Interactable involved in the event.

    Remarks

    The interactor and interactable are notified immediately without waiting for a previous call to finish in the case when this method is called again in a nested way. This means that if this method is called during the handling of the first event, the second will start and finish before the first event finishes calling all methods in the sequence to notify of the first event.

    TryGetInteractableForCollider(Collider, out IXRInteractable)

    Gets the Interactable a specific Collider is attached to.

    Declaration
    public bool TryGetInteractableForCollider(Collider interactableCollider, out IXRInteractable interactable)
    Parameters
    Type Name Description
    Collider interactableCollider

    The collider of the Interactable to retrieve.

    IXRInteractable interactable

    The returned Interactable associated with the collider.

    Returns
    Type Description
    Boolean

    Returns true if an Interactable was associated with the collider. Otherwise, returns false.

    TryGetInteractableForCollider(Collider, out IXRInteractable, out XRInteractableSnapVolume)

    Gets the Interactable a specific Collider is attached to.

    Declaration
    public bool TryGetInteractableForCollider(Collider interactableCollider, out IXRInteractable interactable, out XRInteractableSnapVolume snapVolume)
    Parameters
    Type Name Description
    Collider interactableCollider

    The collider of the Interactable to retrieve.

    IXRInteractable interactable

    The returned Interactable associated with the collider.

    XRInteractableSnapVolume snapVolume

    The returned snap volume associated with the collider.

    Returns
    Type Description
    Boolean

    Returns true if an Interactable was associated with the collider. Otherwise, returns false.

    UnregisterInteractable(IXRInteractable)

    Unregister an Interactable so it is no longer processed.

    Declaration
    public virtual void UnregisterInteractable(IXRInteractable interactable)
    Parameters
    Type Name Description
    IXRInteractable interactable

    The Interactable to be unregistered.

    UnregisterInteractionGroup(IXRInteractionGroup)

    Unregister an Interaction Group so it is no longer processed.

    Declaration
    public virtual void UnregisterInteractionGroup(IXRInteractionGroup interactionGroup)
    Parameters
    Type Name Description
    IXRInteractionGroup interactionGroup

    The Interaction Group to be unregistered.

    UnregisterInteractor(IXRInteractor)

    Unregister an Interactor so it is no longer processed.

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

    The Interactor to be unregistered.

    UnregisterSnapVolume(XRInteractableSnapVolume)

    Unregister the snap volume so it is no longer associated with the snap collider or interactable.

    Declaration
    public void UnregisterSnapVolume(XRInteractableSnapVolume snapVolume)
    Parameters
    Type Name Description
    XRInteractableSnapVolume snapVolume

    The snap volume to be unregistered.

    See Also
    RegisterSnapVolume(XRInteractableSnapVolume)

    Update()

    See MonoBehaviour.

    Declaration
    protected virtual void Update()

    Events

    interactableRegistered

    Calls the methods in its invocation list when an IXRInteractable is registered.

    Declaration
    public event Action<InteractableRegisteredEventArgs> interactableRegistered
    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
    RegisterInteractable(IXRInteractable)
    registered

    interactableUnregistered

    Calls the methods in its invocation list when an IXRInteractable is unregistered.

    Declaration
    public event Action<InteractableUnregisteredEventArgs> interactableUnregistered
    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
    UnregisterInteractable(IXRInteractable)
    unregistered

    interactionGroupRegistered

    Calls the methods in its invocation list when an IXRInteractionGroup is registered.

    Declaration
    public event Action<InteractionGroupRegisteredEventArgs> interactionGroupRegistered
    Event Type
    Type Description
    Action<InteractionGroupRegisteredEventArgs>
    Remarks

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

    See Also
    RegisterInteractionGroup(IXRInteractionGroup)
    registered

    interactionGroupUnregistered

    Calls the methods in its invocation list when an IXRInteractionGroup is unregistered.

    Declaration
    public event Action<InteractionGroupUnregisteredEventArgs> interactionGroupUnregistered
    Event Type
    Type Description
    Action<InteractionGroupUnregisteredEventArgs>
    Remarks

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

    See Also
    UnregisterInteractionGroup(IXRInteractionGroup)
    unregistered

    interactorRegistered

    Calls the methods in its invocation list when an IXRInteractor is registered.

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

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

    See Also
    RegisterInteractor(IXRInteractor)
    registered

    interactorUnregistered

    Calls the methods in its invocation list when an IXRInteractor is unregistered.

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

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

    See Also
    UnregisterInteractor(IXRInteractor)
    unregistered

    See Also

    IXRInteractor
    IXRInteractable
    Back to top
    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