Struct TrackableChanges<T>
Holds arrays of changes to trackables (added, updated, and removed). This is typically used by subsystems to report changes each frame.
Implements
Inherited Members
Namespace: UnityEngine .XR.ARSubsystems
Assembly: Unity.XR.ARSubsystems.dll
Syntax
public struct TrackableChanges<T> : IDisposable where T : struct, ITrackable
Type Parameters
Name | Description |
---|---|
T | The ITrackable that can be added and updated. |
Constructors
TrackableChanges(int, int, int, Allocator)
Constructs a TrackableNativeArray
s added, updated, and removed
and should be disposed by calling Dispose() on this object.
Declaration
public TrackableChanges(int addedCount, int updatedCount, int removedCount, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
int | addedCount | The number of added trackables. |
int | updatedCount | The number of updated trackables. |
int | removedCount | The number of removed trackables. |
Allocator | allocator | An allocator to use for each of added, updated, and removed arrays. |
TrackableChanges(int, int, int, Allocator, T)
Constructor which creates all three arrays and fills the
added and updated arrays with repeated copies of
defaultValue
.
Declaration
public TrackableChanges(int addedCount, int updatedCount, int removedCount, Allocator allocator, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
int | addedCount | The number of added trackables. |
int | updatedCount | The number of updated trackables. |
int | removedCount | The number of removed trackables. |
Allocator | allocator | The allocator to use for each of added, updated, and removed arrays. |
T | defaultValue |
TrackableChanges(void*, int, void*, int, void*, int, T, int, Allocator)
Constructs a Trackable
Declaration
public TrackableChanges(void* addedPtr, int addedCount, void* updatedPtr, int updatedCount, void* removedPtr, int removedCount, T defaultT, int stride, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
void* | addedPtr | A pointer to a block of memory containing |
int | addedCount | The number of added elements. |
void* | updatedPtr | A pointer to a block of memory containing |
int | updatedCount | The number of updated elements. |
void* | removedPtr | A pointer to a block of memory containing |
int | removedCount | The number of removed elements. |
T | defaultT | A default |
int | stride | The number of bytes for each element in the |
Allocator | allocator | An allocator to use when creating the added, updated, and removed arrays. |
Remarks
Because native code might be using an older version of T
,
this constructor first fills the added and updated
arrays with copies of defaultT
before copying the data from
the addedPtr
and updatedPtr
pointers.
This ensures that the addition of new fields to T
will have
appropriate default values.
Properties
added
An array of added trackables.
Declaration
public NativeArray<T> added { get; }
Property Value
Type | Description |
---|---|
Native |
isCreated
Whether the NativeArray
s have been created.
Declaration
public readonly bool isCreated { get; }
Property Value
Type | Description |
---|---|
bool |
removed
An array of Trackable
Declaration
public NativeArray<TrackableId> removed { get; }
Property Value
Type | Description |
---|---|
Native |
updated
An array of updated trackables.
Declaration
public NativeArray<T> updated { get; }
Property Value
Type | Description |
---|---|
Native |
Methods
CopyFrom(NativeArray<T>, NativeArray<T>, NativeArray<TrackableId>, Allocator)
Creates a new TrackableNativeArrays
.
Declaration
public static TrackableChanges<T> CopyFrom(NativeArray<T> added, NativeArray<T> updated, NativeArray<TrackableId> removed, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Native |
added | An array of added elements. |
Native |
updated | An array of updated elements. |
Native |
removed | An array of removed elements. |
Allocator | allocator | The allocator to use for each of the added, updated, and removed arrays. |
Returns
Type | Description |
---|---|
Trackable |
A new Trackable |
Dispose()
Disposes the added, updated, and removed arrays.
Safe to call on a default-constructed Trackable
Declaration
public void Dispose()