docs.unity3d.com
    Show / Hide Table of Contents

    Struct XRReferenceImage

    Represents an entry in an XRReferenceImageLibrary.

    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    [Serializable]
    public struct XRReferenceImage : IEquatable<XRReferenceImage>
    Remarks

    A reference image is an image to look for in the physical environment. The XRReferenceImage does not directly reference a Texture2D or other image data; it only stores the GUID of the Texture2D as it appears in the AssetDatabase. At build time, platform specific build steps may use the guids to look up the source textures and generate an appropriate image database. At runtime, detected images can be matched up with the source XRReferenceImage.

    Constructors

    XRReferenceImage(SerializableGuid, SerializableGuid, Nullable<Vector2>, String, Texture2D)

    Constructs a XRReferenceImage.

    Declaration
    public XRReferenceImage(SerializableGuid guid, SerializableGuid textureGuid, Vector2? size, string name, Texture2D texture)
    Parameters
    Type Name Description
    SerializableGuid guid

    The Guid associated with this image.

    SerializableGuid textureGuid

    The Guid of the source texture as it appeared in the AssetDatabase in the Editor.

    Nullable<Vector2> size

    Optional. The size of the image, in meters. This can improve image detection, and may be required by some platforms.

    String name

    A name associated with this reference image.

    Texture2D texture

    The source texture which this reference image represents. This may be null to avoid including the texture in the Player build if that is not desired. See XRReferenceImageLibraryExtensions.SetTexture for more details.

    Properties

    guid

    The Guid associated with this image.

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

    height

    The height of the image, in meters.

    Declaration
    public readonly float height { get; }
    Property Value
    Type Description
    Single

    name

    A name associated with this reference image.

    Declaration
    public readonly string name { get; }
    Property Value
    Type Description
    String

    size

    The size of the image, in meters. This can improve image detection, and may be required by some platforms.

    Declaration
    public readonly Vector2 size { get; }
    Property Value
    Type Description
    Vector2

    specifySize

    Must be set to true for size to be used.

    Declaration
    public readonly bool specifySize { get; }
    Property Value
    Type Description
    Boolean

    texture

    The source texture which this reference image represents. This may be null to avoid including the texture in the Player build if that is not desired. See UnityEditor.XR.ARSubsystems.XRReferenceImageLibraryExtensions.SetTexture for more details.

    Declaration
    public readonly Texture2D texture { get; }
    Property Value
    Type Description
    Texture2D

    textureGuid

    The Guid of the source texture as it appeared in the AssetDatabase in the Editor.

    Declaration
    public readonly Guid textureGuid { get; }
    Property Value
    Type Description
    Guid

    width

    The width of the image, in meters.

    Declaration
    public readonly float width { get; }
    Property Value
    Type Description
    Single

    Methods

    Equals(Object)

    Tests for equality.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The object to compare against.

    Returns
    Type Description
    Boolean

    True if obj is of type XRReferenceImage and Equals(XRReferenceImage) also returns true; otherwise false.

    Overrides
    ValueType.Equals(Object)

    Equals(XRReferenceImage)

    Tests for equality.

    Declaration
    public bool Equals(XRReferenceImage other)
    Parameters
    Type Name Description
    XRReferenceImage other

    The other XRReferenceImage to compare against.

    Returns
    Type Description
    Boolean

    True if the guid of this reference image matches other's, otherwise false.

    GetHashCode()

    Generates a hash suitable for use with containers like HashSet and Dictionary.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    A hash code generated from this object's guid.

    Overrides
    ValueType.GetHashCode()

    ToString()

    Provides a string representation suitable for debug logging.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A string representation of the reference image.

    Overrides
    ValueType.ToString()

    Operators

    Equality(XRReferenceImage, XRReferenceImage)

    Tests for equality. Same as Equals(XRReferenceImage).

    Declaration
    public static bool operator ==(XRReferenceImage lhs, XRReferenceImage rhs)
    Parameters
    Type Name Description
    XRReferenceImage lhs

    The left-hand side of the comparison.

    XRReferenceImage rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    Boolean

    True if lhs is equal to rhs, otherwise false.

    Inequality(XRReferenceImage, XRReferenceImage)

    Tests for inequality. Same as !Equals(XRReferenceImage).

    Declaration
    public static bool operator !=(XRReferenceImage lhs, XRReferenceImage rhs)
    Parameters
    Type Name Description
    XRReferenceImage lhs

    The left-hand side of the comparison.

    XRReferenceImage rhs

    The right-hand side of the comparison.

    Returns
    Type Description
    Boolean

    True if lhs is not equal to rhs, otherwise false.

    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