docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ARRaycastManager

    Manages an XRRaycastSubsystem, exposing raycast functionality in AR Foundation. Use this component to raycast against trackables (that is, detected features in the physical environment) when they do not have a presence in the Physics world.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider>
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider, XRRaycast, ARRaycast>
    ARRaycastManager
    Inherited Members
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider, XRRaycast, ARRaycast>.trackables
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider, XRRaycast, ARRaycast>.SetTrackablesActive(bool)
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider>.subsystem
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider>.descriptor
    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.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, 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.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectsOfType<T>(bool)
    Object.FindObjectOfType<T>()
    Object.FindObjectOfType<T>(bool)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.XR.ARFoundation
    Assembly: Unity.XR.ARFoundation.dll
    Syntax
    [DefaultExecutionOrder(-2147483647)]
    [DisallowMultipleComponent]
    [RequireComponent(typeof(XROrigin))]
    public sealed class ARRaycastManager : ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider, XRRaycast, ARRaycast>
    Remarks

    Related information: AR Raycast Manager component

    Properties

    gameObjectName

    The name of the GameObject for each instantiated ARRaycast.

    Declaration
    protected override string gameObjectName { get; }
    Property Value
    Type Description
    string
    Overrides
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider, XRRaycast, ARRaycast>.gameObjectName

    raycastPrefab

    If not null, this prefab will be instantiated for each ARRaycast.

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

    Methods

    AddRaycast(Vector2, float)

    Creates an ARRaycast that updates automatically. ARRaycasts will continue to update until you remove them with RemoveRaycast(ARRaycast) or disable this component.

    Declaration
    public ARRaycast AddRaycast(Vector2 screenPoint, float estimatedDistance)
    Parameters
    Type Name Description
    Vector2 screenPoint

    A point on the screen, in pixels.

    float estimatedDistance

    The estimated distance to the intersection point. This can be used to determine a potential intersection before the environment has been fully mapped.

    Returns
    Type Description
    ARRaycast

    A new ARRaycast if successful; otherwise null.

    GetPrefab()

    Gets the Prefab that should be instantiated for each ARRaycast. Can be null.

    Declaration
    protected override GameObject GetPrefab()
    Returns
    Type Description
    GameObject

    The Prefab that should be instantiated for each ARRaycast.

    Overrides
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider, XRRaycast, ARRaycast>.GetPrefab()

    OnAfterSetSessionRelativeData(ARRaycast, XRRaycast)

    Invoked just after a ARRaycast has been updated.

    Declaration
    protected override void OnAfterSetSessionRelativeData(ARRaycast raycast, XRRaycast sessionRelativeData)
    Parameters
    Type Name Description
    ARRaycast raycast

    The ARRaycast being updated.

    XRRaycast sessionRelativeData

    The new data associated with the raycast. All spatial data is is session-relative space.

    Overrides
    ARTrackableManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider, XRRaycast, ARRaycast>.OnAfterSetSessionRelativeData(ARRaycast, XRRaycast)

    OnAfterStart()

    Invoked just after the subsystem has been Started. Used to set raycast delegates internally.

    Declaration
    protected override void OnAfterStart()
    Overrides
    SubsystemLifecycleManager<XRRaycastSubsystem, XRRaycastSubsystemDescriptor, XRRaycastSubsystem.Provider>.OnAfterStart()

    Raycast(Ray, List<ARRaycastHit>, TrackableType)

    Cast a Ray against trackables, that is, detected features such as planes.

    Declaration
    public bool Raycast(Ray ray, List<ARRaycastHit> hitResults, TrackableType trackableTypes = (TrackableType)-1)
    Parameters
    Type Name Description
    Ray ray

    The Ray, in Unity world space, to cast.

    List<ARRaycastHit> hitResults

    Contents are replaced with the raycast results, if successful. Results are sorted by distance in closest-first order.

    TrackableType trackableTypes

    (Optional) The types of trackables to cast against.

    Returns
    Type Description
    bool

    true if the raycast hit a trackable in the trackableTypes. Otherwise, false.

    Raycast(Vector2, List<ARRaycastHit>, TrackableType)

    Cast a ray from a point in screen space against trackables, that is, detected features such as planes.

    Declaration
    public bool Raycast(Vector2 screenPoint, List<ARRaycastHit> hitResults, TrackableType trackableTypes = (TrackableType)-1)
    Parameters
    Type Name Description
    Vector2 screenPoint

    The point, in device screen pixels, from which to cast.

    List<ARRaycastHit> hitResults

    Contents are replaced with the raycast results, if successful. Results are sorted by distance in closest-first order.

    TrackableType trackableTypes

    (Optional) The types of trackables to cast against.

    Returns
    Type Description
    bool

    true if the raycast hit a trackable in the trackableTypes. Otherwise, false.

    RemoveRaycast(ARRaycast)

    Removes an existing ARRaycast.

    Declaration
    public void RemoveRaycast(ARRaycast raycast)
    Parameters
    Type Name Description
    ARRaycast raycast

    The ARRaycast to remove.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if raycast is null.

    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)