docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRReferenceImageBuilder

    Defines a fluent API for constructing an XRReferenceImage.

    Inheritance
    object
    XRReferenceImageBuilder
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.XR.ARSubsystems
    Assembly: Unity.XR.ARSubsystems.dll
    Syntax
    public class XRReferenceImageBuilder

    Constructors

    XRReferenceImageBuilder()

    Construct an instance.

    Declaration
    public XRReferenceImageBuilder()

    Methods

    Build()

    Build an output XRReferenceImage using all this builder's parameter values.

    Declaration
    public XRReferenceImage Build()
    Returns
    Type Description
    XRReferenceImage

    The built XRReferenceImage.

    FromReferenceImage(XRReferenceImage)

    Initialize all fields using data from the given reference image.

    Declaration
    public XRReferenceImageBuilder FromReferenceImage(XRReferenceImage referenceImage)
    Parameters
    Type Name Description
    XRReferenceImage referenceImage

    The reference image.

    Returns
    Type Description
    XRReferenceImageBuilder

    This instance.

    Reset()

    Reset the instance to default values.

    Declaration
    public void Reset()

    WithGuid(SerializableGuid)

    Set the SerializableGuid for built XRReferenceImage instances.

    Declaration
    public XRReferenceImageBuilder WithGuid(SerializableGuid guid)
    Parameters
    Type Name Description
    SerializableGuid guid

    The SerializableGuid associated with the reference image.

    Returns
    Type Description
    XRReferenceImageBuilder

    This instance.

    WithMovingImageType(MovingImageType)

    Set the moving image type for built XRReferenceImage instances.

    Declaration
    public XRReferenceImageBuilder WithMovingImageType(MovingImageType movingImageType)
    Parameters
    Type Name Description
    MovingImageType movingImageType

    Indicates whether the image is expected to move in the real world. This overrides the moving image setting on the image library that contains it.

    Returns
    Type Description
    XRReferenceImageBuilder

    This instance.

    WithName(string)

    Set the name for built XRReferenceImage instances.

    Declaration
    public XRReferenceImageBuilder WithName(string name)
    Parameters
    Type Name Description
    string name

    A name associated with the reference image.

    Returns
    Type Description
    XRReferenceImageBuilder

    This instance.

    WithSize(Vector2?)

    Set the physical size, in meters, for built XRReferenceImage instances.

    Declaration
    public XRReferenceImageBuilder WithSize(Vector2? size)
    Parameters
    Type Name Description
    Vector2? size

    The size of the image, in meters, or null to leave the size unspecified. Specifying a size can improve image detection, and might be required by some platforms.

    Returns
    Type Description
    XRReferenceImageBuilder

    This instance.

    WithTexture(Texture2D)

    Set the source texture for built XRReferenceImage instances.

    Declaration
    public XRReferenceImageBuilder WithTexture(Texture2D texture)
    Parameters
    Type Name Description
    Texture2D texture

    The source texture which the reference image represents. This can be null to avoid including the texture in the Player build.

    Returns
    Type Description
    XRReferenceImageBuilder

    This instance.

    WithTextureGuid(SerializableGuid)

    Set the texture SerializableGuid for built XRReferenceImage instances.

    Declaration
    public XRReferenceImageBuilder WithTextureGuid(SerializableGuid textureGuid)
    Parameters
    Type Name Description
    SerializableGuid textureGuid

    The SerializableGuid of the source texture as it appears in the AssetDatabase in the Editor.

    Returns
    Type Description
    XRReferenceImageBuilder

    This instance.

    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)