docs.unity3d.com
    Show / Hide Table of Contents

    Class ARAnchorManager

    Manages anchors.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>
    ARAnchorManager
    Inherited Members
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.trackables
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.SetTrackablesActive(Boolean)
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.sessionOrigin
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.gameObjectName
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.GetPrefab()
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.m_Trackables
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.m_PendingAdds
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.Awake()
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.Update()
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.OnTrackablesChanged(List<ARAnchor>, List<ARAnchor>, List<ARAnchor>)
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.OnCreateTrackable(ARAnchor)
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.OnAfterSetSessionRelativeData(ARAnchor, XRAnchor)
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.CreateTrackableImmediate(XRAnchor)
    ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>.DestroyPendingTrackable(TrackableId)
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.subsystem
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.descriptor
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.GetActiveSubsystemInstance()
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.EnsureSubsystemInstanceSet()
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.OnEnable()
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.OnDisable()
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.OnDestroy()
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.OnBeforeStart()
    SubsystemLifecycleManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor>.OnAfterStart()
    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.FindObjectsOfType(Type, Boolean)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.XR.ARFoundation
    Syntax
    [DefaultExecutionOrder(-2147483647)]
    [DisallowMultipleComponent]
    [RequireComponent(typeof(ARSessionOrigin))]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.0/api/UnityEngine.XR.ARFoundation.ARAnchorManager.html")]
    public sealed class ARAnchorManager : ARTrackableManager<XRAnchorSubsystem, XRAnchorSubsystemDescriptor, XRAnchor, ARAnchor>
    Remarks

    Use this component to programmatically add, remove, or query for anchors. Anchors are Poses in the world which will be periodically updated by an AR device as its understanding of the world changes.

    Subscribe to changes (added, updated, and removed) via the anchorsChanged event.

    Properties

    anchorPrefab

    This prefab will be instantiated for each ARAnchor. May be null.

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

    The purpose of this property is to extend the functionality of ARAnchors. It is not the recommended way to instantiate content associated with an ARAnchor. See Anchoring content for more details.

    gameObjectName

    The name to assign to the GameObject instantiated for each ARAnchor.

    Declaration
    protected override string gameObjectName { get; }
    Property Value
    Type Description
    String
    Overrides
    UnityEngine.XR.ARFoundation.ARTrackableManager<UnityEngine.XR.ARSubsystems.XRAnchorSubsystem, UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRAnchor, UnityEngine.XR.ARFoundation.ARAnchor>.gameObjectName

    Methods

    AddAnchor(Pose)

    Attempts to add an ARAnchor with the given Pose.

    Declaration
    public ARAnchor AddAnchor(Pose pose)
    Parameters
    Type Name Description
    Pose pose

    The pose, in Unity world space, of the ARAnchor.

    Returns
    Type Description
    ARAnchor

    A new ARAnchor if successful, otherwise null.

    Remarks

    If GetPrefab() is not null, a new instance of that prefab will be instantiated. Otherwise, a new GameObject will be created. In either case, the resulting GameObject will have an ARAnchor component on it.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if this MonoBehaviour is not enabled.

    InvalidOperationException

    Thrown if the underlying subsystem is null.

    AttachAnchor(ARPlane, Pose)

    Attempts to create a new anchor that is attached to an existing ARPlane.

    Declaration
    public ARAnchor AttachAnchor(ARPlane plane, Pose pose)
    Parameters
    Type Name Description
    ARPlane plane

    The ARPlane to which to attach.

    Pose pose

    The initial Pose, in Unity world space, of the anchor.

    Returns
    Type Description
    ARAnchor

    A new ARAnchor if successful, otherwise null.

    GetAnchor(TrackableId)

    Gets the ARAnchor with given trackableId, or null if it does not exist.

    Declaration
    public ARAnchor GetAnchor(TrackableId trackableId)
    Parameters
    Type Name Description
    TrackableId trackableId

    The TrackableId of the ARAnchor to retrieve.

    Returns
    Type Description
    ARAnchor

    The ARAnchor with trackableId or null if it does not exist.

    GetPrefab()

    Get the prefab to instantiate for each ARAnchor.

    Declaration
    protected override GameObject GetPrefab()
    Returns
    Type Description
    GameObject

    The prefab to instantiate for each ARAnchor.

    Overrides
    UnityEngine.XR.ARFoundation.ARTrackableManager<UnityEngine.XR.ARSubsystems.XRAnchorSubsystem, UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRAnchor, UnityEngine.XR.ARFoundation.ARAnchor>.GetPrefab()

    OnTrackablesChanged(List<ARAnchor>, List<ARAnchor>, List<ARAnchor>)

    Invoked when the base class detects trackable changes.

    Declaration
    protected override void OnTrackablesChanged(List<ARAnchor> added, List<ARAnchor> updated, List<ARAnchor> removed)
    Parameters
    Type Name Description
    List<ARAnchor> added

    The list of added anchors.

    List<ARAnchor> updated

    The list of updated anchors.

    List<ARAnchor> removed

    The list of removed anchors.

    Overrides
    UnityEngine.XR.ARFoundation.ARTrackableManager<UnityEngine.XR.ARSubsystems.XRAnchorSubsystem, UnityEngine.XR.ARSubsystems.XRAnchorSubsystemDescriptor, UnityEngine.XR.ARSubsystems.XRAnchor, UnityEngine.XR.ARFoundation.ARAnchor>.OnTrackablesChanged(System.Collections.Generic.List<UnityEngine.XR.ARFoundation.ARAnchor>, System.Collections.Generic.List<UnityEngine.XR.ARFoundation.ARAnchor>, System.Collections.Generic.List<UnityEngine.XR.ARFoundation.ARAnchor>)

    RemoveAnchor(ARAnchor)

    Attempts to remove an ARAnchor.

    Declaration
    public bool RemoveAnchor(ARAnchor anchor)
    Parameters
    Type Name Description
    ARAnchor anchor

    The anchor you wish to remove.

    Returns
    Type Description
    Boolean

    True if the anchor was successfully removed. False usually means the anchor is not longer tracked by the system.

    Events

    anchorsChanged

    Invoked once per frame to communicate changes to anchors, including new anchors, the update of existing anchors, and the removal of previously existing anchors.

    Declaration
    public event Action<ARAnchorsChangedEventArgs> anchorsChanged
    Event Type
    Type Description
    Action<ARAnchorsChangedEventArgs>

    See Also

    ARTrackableManager<TSubsystem, TSubsystemDescriptor, TSessionRelativeData, TTrackable>
    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