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
    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