Class XRMarkerSubsystem.Provider
The provider interface to be implemented by XR platform plugin packages.
Inherited Members
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 |
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 |
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 |
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.