docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class TrackedDeviceGraphicRaycaster

    Custom implementation of GraphicRaycaster for XR Interaction Toolkit. This behavior is used to ray cast against a Canvas. The Raycaster looks at all Graphics on the canvas and determines if any of them have been hit by a ray from a tracked device.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    UIBehaviour
    BaseRaycaster
    TrackedDeviceGraphicRaycaster
    Implements
    IPokeStateDataProvider
    IMultiPokeStateDataProvider
    Inherited Members
    BaseRaycaster.ToString()
    BaseRaycaster.OnEnable()
    BaseRaycaster.OnCanvasHierarchyChanged()
    BaseRaycaster.OnTransformParentChanged()
    BaseRaycaster.sortOrderPriority
    BaseRaycaster.renderOrderPriority
    BaseRaycaster.rootRaycaster
    UIBehaviour.Start()
    UIBehaviour.IsActive()
    UIBehaviour.OnValidate()
    UIBehaviour.Reset()
    UIBehaviour.OnRectTransformDimensionsChange()
    UIBehaviour.OnBeforeTransformParentChanged()
    UIBehaviour.OnDidApplyAnimationProperties()
    UIBehaviour.OnCanvasGroupChanged()
    UIBehaviour.IsDestroyed()
    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.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.Interaction.Toolkit.UI
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [AddComponentMenu("Event/Tracked Device Graphic Raycaster", 11)]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@3.2/api/UnityEngine.XR.Interaction.Toolkit.UI.TrackedDeviceGraphicRaycaster.html")]
    public class TrackedDeviceGraphicRaycaster : BaseRaycaster, IPokeStateDataProvider, IMultiPokeStateDataProvider

    Properties

    blockingMask

    The layers of objects that are checked to determine if they block Graphic ray casts when checking for 2D or 3D occlusion.

    Declaration
    public LayerMask blockingMask { get; set; }
    Property Value
    Type Description
    LayerMask

    checkFor2DOcclusion

    Whether or not 2D occlusion is checked when performing ray casts. Enable to make Graphics be blocked by 2D objects that exist in front of it.

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

    This property has no effect when the project does not include the Physics 2D module.

    checkFor3DOcclusion

    Whether or not 3D occlusion is checked when performing ray casts. Enable to make Graphics be blocked by 3D objects that exist in front of it.

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

    eventCamera

    See BaseRaycaster.eventCamera.

    Declaration
    public override Camera eventCamera { get; }
    Property Value
    Type Description
    Camera
    Overrides
    BaseRaycaster.eventCamera

    ignoreReversedGraphics

    Whether Graphics facing away from the ray caster are checked for ray casts. Enable this to ignore backfacing Graphics.

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

    pokeStateData

    Unity.XR.CoreUtils.Bindings.Variables.IReadOnlyBindableVariable<T> that updates whenever the poke logic state is evaluated.

    Declaration
    public IReadOnlyBindableVariable<PokeStateData> pokeStateData { get; }
    Property Value
    Type Description
    IReadOnlyBindableVariable<PokeStateData>
    See Also
    PokeStateData

    raycastTriggerInteraction

    Specifies whether the ray cast should hit Triggers when checking for 3D occlusion.

    Declaration
    public QueryTriggerInteraction raycastTriggerInteraction { get; set; }
    Property Value
    Type Description
    QueryTriggerInteraction
    Remarks

    When set to UseGlobal, the value of Queries Hit Triggers (queriesHitTriggers) in Edit > Project Settings > Physics will be used.

    Methods

    Awake()

    See MonoBehaviour.Awake.

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

    GetPokeStateDataForTarget(Transform)

    Gets the PokeStateData as an Unity.XR.CoreUtils.Bindings.Variables.IReadOnlyBindableVariable<T> for the target transform.

    Declaration
    public IReadOnlyBindableVariable<PokeStateData> GetPokeStateDataForTarget(Transform target)
    Parameters
    Type Name Description
    Transform target

    The target to get the PokeStateData for.

    Returns
    Type Description
    IReadOnlyBindableVariable<PokeStateData>

    Returns an Unity.XR.CoreUtils.Bindings.Variables.IReadOnlyBindableVariable<T> for the PokeStateData for the target.

    IsPokeInteractingWithUI(IUIInteractor)

    Checks if poke interactor is interacting with any raycaster in the scene.

    Declaration
    public static bool IsPokeInteractingWithUI(IUIInteractor interactor)
    Parameters
    Type Name Description
    IUIInteractor interactor

    The IUIInteractor to check against, typically an XRPokeInteractor.

    Returns
    Type Description
    bool

    Returns true if the poke interactor is hovering or selecting any graphic in the scene.

    IsPokeSelectingWithUI(IUIInteractor)

    This method is used to determine if the poke interactor has met the requirements for selecting. This can be treated like the equivalent of left mouse down for a mouse.

    Declaration
    public static bool IsPokeSelectingWithUI(IUIInteractor interactor)
    Parameters
    Type Name Description
    IUIInteractor interactor

    The IUIInteractor to check against, typically an XRPokeInteractor.

    Returns
    Type Description
    bool

    Returns true if the IUIInteractor meets requirements for poke with any TrackedDeviceGraphicRaycaster.

    OnDestroy()

    See MonoBehaviour.OnDestroy.

    Declaration
    protected override void OnDestroy()
    Overrides
    UIBehaviour.OnDestroy()

    OnDisable()

    Declaration
    protected override void OnDisable()
    Overrides
    BaseRaycaster.OnDisable()

    OnDrawGizmosSelected()

    See MonoBehaviour.

    Declaration
    [Conditional("UNITY_EDITOR")]
    protected void OnDrawGizmosSelected()

    Raycast(PointerEventData, List<RaycastResult>)

    Performs a ray cast against objects within this Raycaster's domain.

    Declaration
    public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
    Parameters
    Type Name Description
    PointerEventData eventData

    Data containing where and how to ray cast.

    List<RaycastResult> resultAppendList

    The resultant hits from the ray cast.

    Overrides
    BaseRaycaster.Raycast(PointerEventData, List<RaycastResult>)

    TryGetPokeStateDataForInteractor(IUIInteractor, out PokeStateData)

    Attempts to get the PokeStateData for the provided IUIInteractor.

    Declaration
    public static bool TryGetPokeStateDataForInteractor(IUIInteractor interactor, out PokeStateData data)
    Parameters
    Type Name Description
    IUIInteractor interactor

    The IUIInteractor to check against, typically an XRPokeInteractor.

    PokeStateData data

    The PokeStateData associated with the IUIInteractor if it is found.

    Returns
    Type Description
    bool

    Returns true if the poke interactor is hovering or selecting any graphic in the scene and thus its associated PokeStateData is retrieved successfully, otherwise returns false.

    See Also
    IsPokeInteractingWithUI(IUIInteractor)

    Implements

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