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
    Object
    ScriptableObject
    XRReferenceImageLibrary
    Inherited Members
    ScriptableObject.SetDirty()
    ScriptableObject.CreateInstance(String)
    ScriptableObject.CreateInstance(Type)
    ScriptableObject.CreateInstance<T>()
    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.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    [CreateAssetMenu(fileName = "ReferenceImageLibrary", menuName = "XR/Reference Image Library", order = 1001)]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.1/manual/image-tracking.html")]
    public class XRReferenceImageLibrary : ScriptableObject, IReferenceImageLibrary
    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

    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 images in this library.

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

    An IEnumerator which can be used to iterate over the 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.

    Extension Methods

    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
    Terms of use
    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