docs.unity3d.com
    Show / Hide Table of Contents

    Struct TrackableChanges<T>

    Holds arrays of changes (added, updated, and removed) to trackables. This is typically used by subsystems to report changes each frame.

    Namespace: UnityEngine.XR.ARSubsystems
    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(Int32, Int32, Int32, Allocator)

    Constructs a TrackableChanges<T> from the number of added, updated, and removed trackables. This creates the NativeArrays 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
    Int32 addedCount

    The number of added trackables.

    Int32 updatedCount

    The number of updated trackables.

    Int32 removedCount

    The number of removed trackables.

    Allocator allocator

    An allocator to use for each of added, updated, and removed arrays.

    TrackableChanges(Int32, Int32, Int32, 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
    Int32 addedCount

    The number of added trackables.

    Int32 updatedCount

    The number of updated trackables.

    Int32 removedCount

    The number of removed trackables.

    Allocator allocator

    The allocator to use for each of added, updated, and removed arrays.

    T defaultValue

    The value with which to fill the added and updated arrays.

    TrackableChanges(Void*, Int32, Void*, Int32, Void*, Int32, T, Int32, Allocator)

    Constructs a TrackableChanges<T> from native memory.

    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 continaing addedCount elements each of size stride.

    Int32 addedCount

    The number of added elements.

    Void* updatedPtr

    A pointer to a block of memory continaing updatedCount elements each of size stride.

    Int32 updatedCount

    The number of updated elements.

    Void* removedPtr

    A pointer to a block of memory containing removedCount TrackableIds.

    Int32 removedCount

    The number of removed elements.

    T defaultT

    A default T which should be used to fill the added and updated arrays before copying data from addedPtr and updatedPtr, respectively.

    Int32 stride

    The number of bytes for each element in the addedPtr and updatedPtr arrays.

    Allocator allocator

    An allocator to use when creating the added, updated, and removed arrays.

    Remarks

    Because native code may 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 readonly NativeArray<T> added { get; }
    Property Value
    Type Description
    NativeArray<T>

    isCreated

    Whether the NativeArrays have been created.

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

    removed

    An array of TrackableIds that have been removed.

    Declaration
    public readonly NativeArray<TrackableId> removed { get; }
    Property Value
    Type Description
    NativeArray<TrackableId>

    updated

    An array of updated trackables.

    Declaration
    public readonly NativeArray<T> updated { get; }
    Property Value
    Type Description
    NativeArray<T>

    Methods

    CopyFrom(NativeArray<T>, NativeArray<T>, NativeArray<TrackableId>, Allocator)

    Creates a new TrackableChanges<T> from existing NativeArrays.

    Declaration
    public static TrackableChanges<T> CopyFrom(NativeArray<T> added, NativeArray<T> updated, NativeArray<TrackableId> removed, Allocator allocator)
    Parameters
    Type Name Description
    NativeArray<T> added

    An array of added elements.

    NativeArray<T> updated

    An array of updated elements.

    NativeArray<TrackableId> removed

    An array of removed elements.

    Allocator allocator

    The allocator to use for each of the added, updated, and removed arrays.

    Returns
    Type Description
    TrackableChanges<T>

    a new TrackableChanges<T> from existing NativeArrays. The caller must Dispose() the returned TrackableChanges<T> to avoid memory leaks.

    Dispose()

    Disposes the added, updated, and removed arrays. Safe to call on a default-constructed TrackableChanges<T>.

    Declaration
    public void Dispose()
    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