docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ARTrackedImageManager

    A manager for ARTrackedImages. Uses the XRImageTrackingSubsystem to recognize and track 2D images in the physical environment.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    SubsystemLifecycleManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider>
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>
    ARTrackedImageManager
    Implements
    ITrackablesChanged<ARTrackedImage>
    Inherited Members
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>.trackablesChanged
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>.trackables
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>.SetTrackablesActive(bool)
    SubsystemLifecycleManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider>.subsystem
    SubsystemLifecycleManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.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.destroyCancellationToken
    MonoBehaviour.useGUILayout
    MonoBehaviour.didStart
    MonoBehaviour.didAwake
    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.GetComponentIndex()
    Component.CompareTag(string)
    Component.CompareTag(TagHandle)
    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.InstantiateAsync<T>(T)
    Object.InstantiateAsync<T>(T, Transform)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int)
    Object.InstantiateAsync<T>(T, int, Transform)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion)
    Object.InstantiateAsync<T>(T, int, Transform, Vector3, Quaternion, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>)
    Object.InstantiateAsync<T>(T, int, Transform, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, CancellationToken)
    Object.InstantiateAsync<T>(T, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, Vector3, Quaternion, InstantiateParameters, CancellationToken)
    Object.InstantiateAsync<T>(T, int, ReadOnlySpan<Vector3>, ReadOnlySpan<Quaternion>, InstantiateParameters, CancellationToken)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Scene)
    Object.Instantiate<T>(T, InstantiateParameters)
    Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
    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.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    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.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, bool)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    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)]
    [RequireComponent(typeof(XROrigin))]
    [AddComponentMenu("XR/AR Foundation/AR Tracked Image Manager")]
    [Icon("Packages/com.unity.xr.arfoundation/Editor/Icons/d_ARVR@4x.png")]
    public sealed class ARTrackedImageManager : ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>, ITrackablesChanged<ARTrackedImage>
    Remarks

    Related information: AR Tracked Image Manager component

    Properties

    currentMaxNumberOfMovingImages

    Get the maximum number of moving images to track in real time that is currently in use by the subsystem.

    Declaration
    public int currentMaxNumberOfMovingImages { get; }
    Property Value
    Type Description
    int

    gameObjectName

    The name to be used for the GameObject whenever a new image is detected.

    Declaration
    protected override string gameObjectName { get; }
    Property Value
    Type Description
    string
    Overrides
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>.gameObjectName

    referenceLibrary

    Get or set the reference image library (that is, the set of images to search for in the physical environment).

    Declaration
    public IReferenceImageLibrary referenceLibrary { get; set; }
    Property Value
    Type Description
    IReferenceImageLibrary
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if the referenceLibrary is set to null while image tracking is enabled.

    requestedMaxNumberOfMovingImages

    The requested maximum number of moving images to track in real time.

    Declaration
    public int requestedMaxNumberOfMovingImages { get; set; }
    Property Value
    Type Description
    int
    Remarks

    Support can vary between devices and providers. Check for support at runtime with descriptor's supportsMovingImages property. If supportsMovingImages is false, setting this property has no effect. The reverse isn't guaranteed: a provider can support moving images without supporting a configurable maximum number of them, in which case supportsMovingImages will be true, but setting this property has no effect.

    trackedImagePrefab

    If not null, instantiates this Prefab for each detected image.

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

    The purpose of this property is to extend the functionality of ARTrackedImages. It is not the recommended way to instantiate content associated with an ARTrackedImage.

    Methods

    CreateRuntimeLibrary(XRReferenceImageLibrary)

    Creates a UnityEngine.XR.ARSubsystems.RuntimeReferenceImageLibrary from an existing UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary or an empty library if serializedLibrary is null. Use this to construct reference image libraries at runtime. If the library is of type MutableRuntimeReferenceImageLibrary, it is modifiable at runtime.

    Declaration
    [Obsolete("CreateRuntimeLibrary is deprecated in AR Foundation 6.7. Use TryCreateRuntimeLibraryAsync instead.")]
    public RuntimeReferenceImageLibrary CreateRuntimeLibrary(XRReferenceImageLibrary serializedLibrary = null)
    Parameters
    Type Name Description
    XRReferenceImageLibrary serializedLibrary

    An existing XRReferenceImageLibrary, or null to create an empty image library.

    Returns
    Type Description
    RuntimeReferenceImageLibrary

    A new RuntimeReferenceImageLibrary representing the deserialized version of serializedLibrary or an empty library if serializedLibrary is null.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown if there is no subsystem. This usually means image tracking is not supported.

    GetPrefab()

    Get the Prefab that will be instantiated for each ARTrackedImage.

    Declaration
    protected override GameObject GetPrefab()
    Returns
    Type Description
    GameObject

    The Prefab that will be instantiated for each ARTrackedImage.

    Overrides
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>.GetPrefab()

    OnAfterSetSessionRelativeData(ARTrackedImage, XRTrackedImage)

    Invoked just after updating each ARTrackedImage. Used to update the referenceImage.

    Declaration
    protected override void OnAfterSetSessionRelativeData(ARTrackedImage image, XRTrackedImage sessionRelativeData)
    Parameters
    Type Name Description
    ARTrackedImage image

    The tracked image being updated.

    XRTrackedImage sessionRelativeData

    New data associated with the tracked image. Spatial data is relative to the XROrigin.

    Overrides
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>.OnAfterSetSessionRelativeData(ARTrackedImage, XRTrackedImage)

    OnBeforeStart()

    Sets the image library on the subsystem before Start() is called on the XRImageTrackingSubsystem.

    Declaration
    protected override void OnBeforeStart()
    Overrides
    SubsystemLifecycleManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider>.OnBeforeStart()

    OnTrackablesChanged(List<ARTrackedImage>, List<ARTrackedImage>, List<ARTrackedImage>)

    Invokes the trackedImagesChanged event.

    Declaration
    [Obsolete("OnTrackablesChanged() has been deprecated in AR Foundation version 6.0.", false)]
    protected override void OnTrackablesChanged(List<ARTrackedImage> added, List<ARTrackedImage> updated, List<ARTrackedImage> removed)
    Parameters
    Type Name Description
    List<ARTrackedImage> added

    A list of images added this frame.

    List<ARTrackedImage> updated

    A list of images updated this frame.

    List<ARTrackedImage> removed

    A list of images removed this frame.

    Overrides
    ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRImageTrackingSubsystem.Provider, XRTrackedImage, ARTrackedImage>.OnTrackablesChanged(List<ARTrackedImage>, List<ARTrackedImage>, List<ARTrackedImage>)

    TryCreateRuntimeLibraryAsync(XRReferenceImageLibrary, CancellationToken)

    Attempts to create a RuntimeReferenceImageLibrary from an existing XRReferenceImageLibrary.

    Declaration
    public Awaitable<Result<RuntimeReferenceImageLibrary>> TryCreateRuntimeLibraryAsync(XRReferenceImageLibrary referenceImageLibrary, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    XRReferenceImageLibrary referenceImageLibrary

    An existing XRReferenceImageLibrary, or null to create an empty image library.

    CancellationToken cancellationToken

    A cancellation token, which you can use to cancel the operation in progress.

    Returns
    Type Description
    Awaitable<Result<RuntimeReferenceImageLibrary>>

    The result of the operation.

    Remarks

    If referenceImageLibrary is null, the new library is empty. You can only add images to the resulting library if the platform supports mutable libraries; refer to supportsMutableLibrary.

    Exceptions
    Type Condition
    NotSupportedException

    Thrown if the provider doesn't implement asynchronous library creation.

    OperationCanceledException

    Thrown if the operation is canceled by cancellationToken.

    TrySetReferenceLibrary(RuntimeReferenceImageLibrary)

    Attempts to assign runtimeLibrary to this manager.

    Declaration
    public XRResultStatus TrySetReferenceLibrary(RuntimeReferenceImageLibrary runtimeLibrary)
    Parameters
    Type Name Description
    RuntimeReferenceImageLibrary runtimeLibrary

    The runtime library to assign.

    Returns
    Type Description
    XRResultStatus

    The status of the operation.

    Examples
    var status = manager.TrySetReferenceLibrary(runtimeLibrary);
    if (status.IsSuccess())
        DoSomething();
    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if runtimeLibrary is null.

    TrySetReferenceLibraryAsync(XRReferenceImageLibrary, CancellationToken)

    Attempts to create a runtime reference image library from serializedLibrary, activate it, and assign it to this manager.

    Declaration
    public Awaitable<Result<RuntimeReferenceImageLibrary>> TrySetReferenceLibraryAsync(XRReferenceImageLibrary serializedLibrary, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    XRReferenceImageLibrary serializedLibrary

    The serialized library to convert to a runtime library and assign, or null to assign an empty library.

    CancellationToken cancellationToken

    A cancellation token, which you can use to cancel the operation in progress.

    Returns
    Type Description
    Awaitable<Result<RuntimeReferenceImageLibrary>>

    The result of the async operation.

    Remarks

    After this operation completes successfully, referenceLibrary returns the newly created runtime library.

    Only one asynchronous operation from this method may be in progress at a time. Use the cancellationToken to cancel a previous call to this method if needed, otherwise subsequent calls will fail while an operation is in progress.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if serializedLibrary is null.

    OperationCanceledException

    Thrown if the operation is canceled, either by cancellationToken or because this component was destroyed.

    Events

    trackedImagesChanged

    Invoked once per frame with information about the ARTrackedImages that have changed (that is, been added, updated, or removed). This happens just before ARTrackedImages are destroyed, so you can set ARTrackedImage.destroyOnRemoval to false from this event to suppress this behavior.

    Declaration
    [Obsolete("trackedImagesChanged has been deprecated in AR Foundation version 6.0. Use trackablesChanged instead.", false)]
    public event Action<ARTrackedImagesChangedEventArgs> trackedImagesChanged
    Event Type
    Type Description
    Action<ARTrackedImagesChangedEventArgs>

    Implements

    ITrackablesChanged<TTrackable>
    In This Article
    Back to top
    Copyright © 2026 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)