Class XRSocketInteractor | XR Interaction Toolkit | 0.10.0-preview.7
docs.unity3d.com
    Show / Hide Table of Contents

    Class XRSocketInteractor

    Interactor used for holding interactables via a socket. This component is not designed to be attached to a controller (thus does not derive from XRBaseControllerInteractor) and instead will always attempt to select an interactable that it is hovering over (though will not perform exclusive selection of that interactable).

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRBaseInteractor
    XRSocketInteractor
    Inherited Members
    XRBaseInteractor.interactionManager
    XRBaseInteractor.interactionLayerMask
    XRBaseInteractor.attachTransform
    XRBaseInteractor.startingSelectedInteractable
    XRBaseInteractor.onHoverEntered
    XRBaseInteractor.onHoverEnter
    XRBaseInteractor.onHoverExited
    XRBaseInteractor.onHoverExit
    XRBaseInteractor.onSelectEntered
    XRBaseInteractor.onSelectEnter
    XRBaseInteractor.onSelectExited
    XRBaseInteractor.onSelectExit
    XRBaseInteractor.allowHover
    XRBaseInteractor.allowSelect
    XRBaseInteractor.enableInteractions
    XRBaseInteractor.isPerformingManualInteraction
    XRBaseInteractor.selectTarget
    XRBaseInteractor.hoverTargets
    XRBaseInteractor.Reset()
    XRBaseInteractor.OnEnable()
    XRBaseInteractor.OnDisable()
    XRBaseInteractor.Start()
    XRBaseInteractor.OnDestroy()
    XRBaseInteractor.GetHoverTargets(List<XRBaseInteractable>)
    XRBaseInteractor.OnHoverEntered(XRBaseInteractable)
    XRBaseInteractor.OnHoverExited(XRBaseInteractable)
    XRBaseInteractor.OnSelectEntering(XRBaseInteractable)
    XRBaseInteractor.OnSelectEntered(XRBaseInteractable)
    XRBaseInteractor.OnSelectExited(XRBaseInteractable)
    XRBaseInteractor.StartManualInteraction(XRBaseInteractable)
    XRBaseInteractor.EndManualInteraction()
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Component.rigidbody
    Component.rigidbody2D
    Component.camera
    Component.light
    Component.animation
    Component.constantForce
    Component.renderer
    Component.audio
    Component.networkView
    Component.collider
    Component.collider2D
    Component.hingeJoint
    Component.particleSystem
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    [DisallowMultipleComponent]
    [AddComponentMenu("XR/XR Socket Interactor")]
    public class XRSocketInteractor : XRBaseInteractor

    Properties

    interactableCantHoverMeshMaterial

    Material used for rendering interactable meshes on hover when there is already a selected object in the socket (a default material will be created if none is supplied).

    Declaration
    public Material interactableCantHoverMeshMaterial { get; set; }
    Property Value
    Type Description
    Material

    interactableHoverMeshMaterial

    Material used for rendering interactable meshes on hover (a default material will be created if none is supplied).

    Declaration
    public Material interactableHoverMeshMaterial { get; set; }
    Property Value
    Type Description
    Material

    interactableHoverScale

    Scale at which to render hovered interactable.

    Declaration
    public float interactableHoverScale { get; set; }
    Property Value
    Type Description
    Single

    isHoverActive

    (Read Only) Indicates whether this interactor is in a state where it could hover (always true for sockets if active).

    Declaration
    public override bool isHoverActive { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    XRBaseInteractor.isHoverActive

    isSelectActive

    (Read Only) Indicates whether this interactor is in a state where it could select (always true for sockets if active).

    Declaration
    public override bool isSelectActive { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    XRBaseInteractor.isSelectActive

    recycleDelayTime

    Sets the amount of time the socket will refuse hovers after an object is removed.

    Declaration
    public float recycleDelayTime { get; set; }
    Property Value
    Type Description
    Single

    requireSelectExclusive

    (Read Only) Indicates whether this interactor requires exclusive selection of an interactable (always true for sockets).

    Declaration
    public override bool requireSelectExclusive { get; }
    Property Value
    Type Description
    Boolean
    Overrides
    XRBaseInteractor.requireSelectExclusive

    selectedInteractableMovementTypeOverride

    (Read Only) Overriding movement type of the selected interactable's movement (always Kinematic for sockets).

    Declaration
    public override XRBaseInteractable.MovementType? selectedInteractableMovementTypeOverride { get; }
    Property Value
    Type Description
    Nullable<XRBaseInteractable.MovementType>
    Overrides
    XRBaseInteractor.selectedInteractableMovementTypeOverride

    showInteractableHoverMeshes

    Whether this socket should show a mesh at socket's attach point for interactables that it is hovering over.

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

    socketActive

    Whether socket interaction is enabled.

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

    Methods

    Awake()

    Declaration
    protected override void Awake()
    Overrides
    XRBaseInteractor.Awake()

    CanHover(XRBaseInteractable)

    Determines if the interactable is valid for hover this frame.

    Declaration
    public override bool CanHover(XRBaseInteractable interactable)
    Parameters
    Type Name Description
    XRBaseInteractable interactable

    Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if the interactable can be hovered over this frame.

    Overrides
    XRBaseInteractor.CanHover(XRBaseInteractable)

    CanSelect(XRBaseInteractable)

    Determines if the interactable is valid for selection this frame.

    Declaration
    public override bool CanSelect(XRBaseInteractable interactable)
    Parameters
    Type Name Description
    XRBaseInteractable interactable

    Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if the interactable can be selected this frame.

    Overrides
    XRBaseInteractor.CanSelect(XRBaseInteractable)

    CreateDefaultHoverMaterials()

    Create the default hover materials for interactableHoverMeshMaterial and interactableCantHoverMeshMaterial if necessary.

    Declaration
    protected virtual void CreateDefaultHoverMaterials()

    DrawHoveredInteractables()

    Declaration
    protected virtual void DrawHoveredInteractables()

    GetValidTargets(List<XRBaseInteractable>)

    Retrieve the list of interactables that this interactor could possibly interact with this frame. This list is sorted by priority (in this case distance).

    Declaration
    public override void GetValidTargets(List<XRBaseInteractable> validTargets)
    Parameters
    Type Name Description
    List<XRBaseInteractable> validTargets

    Populated List of interactables that are valid for selection or hover.

    Overrides
    XRBaseInteractor.GetValidTargets(List<XRBaseInteractable>)

    OnHoverEntering(XRBaseInteractable)

    This method is called by the interaction manager right before the interactor first initiates hovering over an interactable.

    Declaration
    protected override void OnHoverEntering(XRBaseInteractable interactable)
    Parameters
    Type Name Description
    XRBaseInteractable interactable

    Interactable that is being hovered over.

    Overrides
    XRBaseInteractor.OnHoverEntering(XRBaseInteractable)
    See Also
    OnHoverEntered(XRBaseInteractable)

    OnHoverExiting(XRBaseInteractable)

    This method is called by the interaction manager right before the interactor ends hovering over an interactable.

    Declaration
    protected override void OnHoverExiting(XRBaseInteractable interactable)
    Parameters
    Type Name Description
    XRBaseInteractable interactable

    Interactable that is no longer hovered over.

    Overrides
    XRBaseInteractor.OnHoverExiting(XRBaseInteractable)
    See Also
    OnHoverExited(XRBaseInteractable)

    OnSelectExiting(XRBaseInteractable)

    This method is called by the interaction manager right before the interactor ends selection of an interactable.

    Declaration
    protected override void OnSelectExiting(XRBaseInteractable interactable)
    Parameters
    Type Name Description
    XRBaseInteractable interactable

    Interactable that is no longer selected.

    Overrides
    XRBaseInteractor.OnSelectExiting(XRBaseInteractable)
    See Also
    OnSelectExited(XRBaseInteractable)

    OnTriggerEnter(Collider)

    Declaration
    protected void OnTriggerEnter(Collider col)
    Parameters
    Type Name Description
    Collider col

    OnTriggerExit(Collider)

    Declaration
    protected void OnTriggerExit(Collider col)
    Parameters
    Type Name Description
    Collider col

    ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)

    This method is called by the interaction manager to update the interactor. Please see the interaction manager documentation for more details on update order.

    Declaration
    public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
    Parameters
    Type Name Description
    XRInteractionUpdateOrder.UpdatePhase updatePhase
    Overrides
    XRBaseInteractor.ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    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