docs.unity3d.com
    Show / Hide Table of Contents

    Struct TrackableCollection<TTrackable>

    A collection for ARTrackable<TSessionRelativeData, TTrackable>s. This collection implements an IEnumerable-like interface which can be used in a foreach statement.

    Namespace: UnityEngine.XR.ARFoundation
    Syntax
    public struct TrackableCollection<TTrackable>
    Type Parameters
    Name Description
    TTrackable

    The concrete ARTrackable<TSessionRelativeData, TTrackable>.

    Constructors

    TrackableCollection(Dictionary<TrackableId, TTrackable>)

    Constructs a .

    Declaration
    public TrackableCollection(Dictionary<TrackableId, TTrackable> trackables)
    Parameters
    Type Name Description
    Dictionary<TrackableId, TTrackable> trackables

    Properties

    count

    Returns the number of trackables in this collection.

    Declaration
    public readonly int count { get; }
    Property Value
    Type Description
    Int32

    Item[TrackableId]

    Retrieves a TTrackables by TrackableId.

    Declaration
    public readonly TTrackable this[TrackableId trackableId] { get; }
    Parameters
    Type Name Description
    TrackableId trackableId

    The trackable id associated with the trackable to retrieve.

    Property Value
    Type Description
    TTrackable

    The TTrackables if present. Throws KeyNotFoundException if the trackableId is not found.

    Methods

    GetEnumerator()

    Creates an Enumerator for this collection.

    Declaration
    public TrackableCollection<TTrackable>.Enumerator GetEnumerator()
    Returns
    Type Description
    TrackableCollection.Enumerator<>

    TryGetTrackable(TrackableId, out TTrackable)

    Attempts to retrieve a trackable by TrackableId.

    Declaration
    public bool TryGetTrackable(TrackableId trackableId, out TTrackable trackable)
    Parameters
    Type Name Description
    TrackableId trackableId

    The trackable id associated with the trackable to retrieve.

    TTrackable trackable

    Set to the trackable with trackableId, if present in the collection.

    Returns
    Type Description
    Boolean

    true if the trackable with trackableId exists. false otherwise.

    Back to top Copyright © 2022 Unity Technologies
    Generated by DocFX
    on Friday, January 7, 2022
    Terms of use