Class ARTrackableManager<TSubsystem, TSubsystemDescriptor, TProvider, TSessionRelativeData, TTrackable>
A generic manager for components generated by features detected in the physical environment.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Assembly: solution.dll
Syntax
[RequireComponent(typeof(ARSessionOrigin))]
[DisallowMultipleComponent]
public abstract class ARTrackableManager<TSubsystem, TSubsystemDescriptor, TProvider, TSessionRelativeData, TTrackable> : SubsystemLifecycleManager<TSubsystem, TSubsystemDescriptor, TProvider> where TSubsystem : TrackingSubsystem<TSessionRelativeData, TSubsystem, TSubsystemDescriptor, TProvider>, new() where TSubsystemDescriptor : SubsystemDescriptorWithProvider<TSubsystem, TProvider> where TProvider : SubsystemProvider<TSubsystem> where TSessionRelativeData : struct, ITrackable where TTrackable : ARTrackable<TSessionRelativeData, TTrackable>
Type Parameters
Name | Description |
---|---|
TSubsystem | The |
TSubsystemDescriptor | The |
TProvider | The provider associated with the |
TSessionRelativeData | A concrete struct used to hold data provided by the Subsystem. |
TTrackable | The type of component that this component will manage (that is, create, update, and destroy). |
Remarks
When the manager is informed that a trackable has been added, a new GameObject
is created with an ARTrackable
component on it. If
ARTrackableManager<TSubsystem, TSubsystemDescriptor, TProvider, TSessionRelativeData, TTrackable>
is not null, then that Prefab will be instantiated.
Fields
Name | Description |
---|---|
m_PendingAdds | A dictionary of trackables added via CreateTrackableImmediate(TSessionRelativeData) but not yet reported as added. |
m_Trackables | A dictionary of all trackables, keyed by |
Properties
Name | Description |
---|---|
gameObjectName | The name prefix that should be used when instantiating new |
sessionOrigin | The |
trackables | A collection of all trackables managed by this component. |
Methods
Name | Description |
---|---|
Awake() | Invoked by Unity once when this component wakes up. |
CanBeAddedToSubsystem(TTrackable) | Determines whether an existing ARTrackable<TSessionRelativeData, TTrackable> can be added to the underlying subsystem. |
CreateTrackableFromExisting(TTrackable, TSessionRelativeData) | Creates the native counterpart for an existing ARTrackable<TSessionRelativeData, TTrackable> added with a call to AddComponent, for example. |
CreateTrackableImmediate(TSessionRelativeData) | Creates a |
DestroyPendingTrackable(TrackableId) | If in a "pending" state and destroyOnRemoval is
|
GetPrefab() | The Prefab that should be instantiated when adding a trackable. Can be |
OnAfterSetSessionRelativeData(TTrackable, TSessionRelativeData) | Invoked just after session-relative data has been set on a trackable. |
OnCreateTrackable(TTrackable) | Invoked after creating the trackable. The trackable's |
OnDisable() | Stops the |
OnEnable() | Creates the |
OnTrackablesChanged(List<TTrackable>, List<TTrackable>, List<TTrackable>) | Invoked when trackables have change (that is, they were added, updated, or removed). Use this to perform additional logic, or to invoke public events related to your trackables. |
SetTrackablesActive(bool) | Iterates over every instantiated ARTrackable<TSessionRelativeData, TTrackable> and
activates or deactivates its |
Update() | Update is called once per frame. This component's internal state is first updated, and then an event notifying whether any trackables have been added, removed, or updated is invoked by the derived manager. |