docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class XRMarkerSubsystem.Provider

    The provider interface to be implemented by XR platform plugin packages.

    Inheritance
    object
    SubsystemProvider
    SubsystemProvider<XRMarkerSubsystem>
    XRMarkerSubsystem.Provider
    Inherited Members
    SubsystemProvider<XRMarkerSubsystem>.TryInitialize()
    SubsystemProvider<XRMarkerSubsystem>.Start()
    SubsystemProvider<XRMarkerSubsystem>.Stop()
    SubsystemProvider<XRMarkerSubsystem>.Destroy()
    SubsystemProvider.running
    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 abstract class XRMarkerSubsystem.Provider : SubsystemProvider<XRMarkerSubsystem>

    Methods

    GetChanges(XRMarker, Allocator)

    Gets the changes (added, updated, and removed markers) since the last call.

    Declaration
    public abstract TrackableChanges<XRMarker> GetChanges(XRMarker defaultMarker, Allocator allocator)
    Parameters
    Type Name Description
    XRMarker defaultMarker

    The default marker instance (used for memory layout).

    Allocator allocator

    The allocator used for the returned data.

    Returns
    Type Description
    TrackableChanges<XRMarker>

    A TrackableChanges<T> describing changes since the last call.

    TryGetBytesData(XRSpatialBuffer)

    Attempts to get the encoded data of a specific marker, decoded as a byte array.

    Declaration
    public abstract Result<byte[]> TryGetBytesData(XRSpatialBuffer dataBuffer)
    Parameters
    Type Name Description
    XRSpatialBuffer dataBuffer

    The spatial buffer of the marker required to retrieve the encoded data.

    Returns
    Type Description
    Result<byte[]>

    A Result which contains the raw byte array if successful.

    Remarks

    To determine if a marker's encoded data is available as binary data, you can check its dataBuffer property. If the bufferType is Uint8, this method should be used to retrieve the encoded data.

    This method allocates a new managed byte[] on each successful call. For performance critical applications that need to avoid garbage collection, consider using (TryGetBytesData(XRSpatialBuffer, Allocator)) directly.

    TryGetBytesData(XRSpatialBuffer, Allocator)

    Attempts to get the encoded data of a specific marker, decoded as a NativeArray_1.

    Declaration
    public abstract Result<NativeArray<byte>> TryGetBytesData(XRSpatialBuffer dataBuffer, Allocator allocator)
    Parameters
    Type Name Description
    XRSpatialBuffer dataBuffer

    The spatial buffer of the marker required to retrieve the encoded data.

    Allocator allocator

    The allocator to use for the returned NativeArray_1.

    Returns
    Type Description
    Result<NativeArray<byte>>

    A Result containing the raw bytes in a NativeArray_1 if the operation is successful.

    Remarks

    This method is useful for performance sensitive applications as it avoids managed memory allocations. The caller is responsible for disposing the returned NativeArray_1 for persistent allocators.

    TryGetStringData(XRSpatialBuffer)

    Attempts to get the encoded data of a specific marker, decoded as a string.

    Declaration
    public abstract Result<string> TryGetStringData(XRSpatialBuffer dataBuffer)
    Parameters
    Type Name Description
    XRSpatialBuffer dataBuffer

    The spatial buffer of the marker required to retrieve the encoded data.

    Returns
    Type Description
    Result<string>

    A Result which contains the decoded string if successful.

    Remarks

    To determine if a marker's encoded data is available as a string, you can check its dataBuffer property. If the bufferType is String, this method should be used to retrieve the encoded data.

    Alternatively, if you expect string data (for example, you are scanning QR codes with URLs), you can call this method directly and check the status to see if it was successful.

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