docs.unity3d.com
    Show / Hide Table of Contents

    Class XRReferenceImageLibrary

    A reference image library is a collection of images to search for in the physical environment when image tracking is enabled.

    Inheritance
    Object
    UnityEngine.Object
    UnityEngine.ScriptableObject
    XRReferenceImageLibrary
    Inherited Members
    UnityEngine.ScriptableObject.SetDirty()
    UnityEngine.ScriptableObject.CreateInstance(System.String)
    UnityEngine.ScriptableObject.CreateInstance(System.Type)
    UnityEngine.ScriptableObject.CreateInstance<T>()
    UnityEngine.Object.GetInstanceID()
    UnityEngine.Object.GetHashCode()
    UnityEngine.Object.Equals(System.Object)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
    UnityEngine.Object.Instantiate(UnityEngine.Object)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform)
    UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform, System.Boolean)
    UnityEngine.Object.Instantiate<T>(T)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform)
    UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform, System.Boolean)
    UnityEngine.Object.Destroy(UnityEngine.Object, System.Single)
    UnityEngine.Object.Destroy(UnityEngine.Object)
    UnityEngine.Object.DestroyImmediate(UnityEngine.Object, System.Boolean)
    UnityEngine.Object.DestroyImmediate(UnityEngine.Object)
    UnityEngine.Object.FindObjectsOfType(System.Type)
    UnityEngine.Object.FindObjectsOfType(System.Type, System.Boolean)
    UnityEngine.Object.DontDestroyOnLoad(UnityEngine.Object)
    UnityEngine.Object.DestroyObject(UnityEngine.Object, System.Single)
    UnityEngine.Object.DestroyObject(UnityEngine.Object)
    UnityEngine.Object.FindSceneObjectsOfType(System.Type)
    UnityEngine.Object.FindObjectsOfTypeIncludingAssets(System.Type)
    UnityEngine.Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    UnityEngine.Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    UnityEngine.Object.FindObjectsOfTypeAll(System.Type)
    UnityEngine.Object.FindObjectOfType(System.Type)
    UnityEngine.Object.FindObjectOfType(System.Type, System.Boolean)
    UnityEngine.Object.ToString()
    UnityEngine.Object.name
    UnityEngine.Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    [CreateAssetMenu(fileName = "ReferenceImageLibrary", menuName = "XR/Reference Image Library", order = 1001)]
    public class XRReferenceImageLibrary : ScriptableObject, IReferenceImageLibrary, ISerializationCallbackReceiver, IEnumerable<XRReferenceImage>, IEnumerable
    Remarks

    Image libraries are immutable at runtime. To create and manipulate an image library via Editor scripts, see the extension methods in XRReferenceImageLibraryExtensions. If you need to mutate the library at runtime, see MutableRuntimeReferenceImageLibrary.

    Properties

    count

    The number of images in the library.

    Declaration
    public int count { get; }
    Property Value
    Type Description
    Int32
    Implements
    IReferenceImageLibrary.count

    dataStore

    (Read Only) Binary data associated with a string key.

    Declaration
    public IReadOnlyDictionary<string, byte[]> dataStore { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<String, Byte[]>
    Remarks

    This is used by providers to associate provider-specific data with the library. During Player Build (in an IPreprocessBuildWithReport.OnPreprocessBuild callback), the data store is first cleared. Each enabled provider then has an opportunity to add one or more entries for itself.

    Providers can use this to store a serialized version of the image library specific to that provider. Set data with SetDataForKey(XRReferenceImageLibrary, String, Byte[]).

    guid

    A GUID associated with this reference library. The GUID is used to uniquely identify this library at runtime.

    Declaration
    public Guid guid { get; }
    Property Value
    Type Description
    Guid

    Item[Int32]

    Get an image by index.

    Declaration
    public XRReferenceImage this[int index] { get; }
    Parameters
    Type Name Description
    Int32 index

    The index of the image in the library. Must be between 0 and count - 1.

    Property Value
    Type Description
    XRReferenceImage

    The XRReferenceImage at index.

    Implements
    IReferenceImageLibrary.Item[Int32]
    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if index is not between 0 and count - 1.

    Methods

    GetEnumerator()

    Gets an enumerator which can be used to iterate over the reference images in this library.

    Declaration
    public List<XRReferenceImage>.Enumerator GetEnumerator()
    Returns
    Type Description
    List.Enumerator<>

    Returns an enumerator which can be used to iterate over the reference images in the library.

    Examples

    This examples iterates over the reference images contained in the library.

    XRReferenceImageLibrary imageLibrary = ...
    foreach (var referenceImage in imageLibrary)
    {
        Debug.LogFormat("Image guid: {0}", referenceImage.guid);
    }

    indexOf(XRReferenceImage)

    Get the index of referenceImage in the image library.

    Declaration
    public int indexOf(XRReferenceImage referenceImage)
    Parameters
    Type Name Description
    XRReferenceImage referenceImage

    The XRReferenceImage to find.

    Returns
    Type Description
    Int32

    The zero-based index of the referenceImage, or -1 if not found.

    Explicit Interface Implementations

    IEnumerable<XRReferenceImage>.GetEnumerator()

    Gets an enumerator which can be used to iterate over the reference images in this library.

    Declaration
    IEnumerator<XRReferenceImage> IEnumerable<XRReferenceImage>.GetEnumerator()
    Returns
    Type Description
    IEnumerator<XRReferenceImage>

    Returns an object which can be used to iterate over the reference images in this library.

    Implements
    IEnumerable<T>.GetEnumerator()

    IEnumerable.GetEnumerator()

    Gets an enumerator which can be used to iterate over the reference images in this library.

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    Returns an object which can be used to iterate over the reference images in this library.

    Implements
    IEnumerable.GetEnumerator()

    ISerializationCallbackReceiver.OnAfterDeserialize()

    Invoked after serialization.

    Declaration
    void ISerializationCallbackReceiver.OnAfterDeserialize()
    Implements
    UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()

    ISerializationCallbackReceiver.OnBeforeSerialize()

    Invoked before serialization.

    Declaration
    void ISerializationCallbackReceiver.OnBeforeSerialize()
    Implements
    UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize()

    Extension Methods

    XRReferenceImageLibraryExtensions.SetDataForKey(XRReferenceImageLibrary, String, Byte[])
    XRReferenceImageLibraryExtensions.ClearDataStore(XRReferenceImageLibrary)
    XRReferenceImageLibraryExtensions.Add(XRReferenceImageLibrary)
    XRReferenceImageLibraryExtensions.SetTexture(XRReferenceImageLibrary, Int32, Texture2D, Boolean)
    XRReferenceImageLibraryExtensions.SetSpecifySize(XRReferenceImageLibrary, Int32, Boolean)
    XRReferenceImageLibraryExtensions.SetSize(XRReferenceImageLibrary, Int32, Vector2)
    XRReferenceImageLibraryExtensions.SetName(XRReferenceImageLibrary, Int32, String)
    XRReferenceImageLibraryExtensions.RemoveAt(XRReferenceImageLibrary, Int32)
    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