Class ARTrackedObjectManager
A manager for ARTrackedObjects. Uses the XRObjectTrackingSubsystem
to recognize and track 3D Objects in the physical environment.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
public sealed class ARTrackedObjectManager : ARTrackableManager<XRObjectTrackingSubsystem, XRObjectTrackingSubsystemDescriptor, XRTrackedObject, ARTrackedObject>
Properties
gameObjectName
The name to be used for the GameObject
whenever a new Object is detected.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
referenceLibrary
The ARObjectLibrary
to use during Object detection. This is the
library of objects which will be detected and/or tracked in the physical environment.
Declaration
public XRReferenceObjectLibrary referenceLibrary { get; set; }
Property Value
Type | Description |
---|---|
XRReferenceObjectLibrary |
trackedObjectPrefab
If not null, instantiates this prefab for each detected object.
Declaration
public GameObject trackedObjectPrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Methods
Awake()
Declaration
protected override void Awake()
Overrides
GetPrefab()
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject |
Overrides
OnAfterSetSessionRelativeData(ARTrackedObject, XRTrackedObject)
Declaration
protected override void OnAfterSetSessionRelativeData(ARTrackedObject trackedObject, XRTrackedObject sessionRelativeData)
Parameters
Type | Name | Description |
---|---|---|
ARTrackedObject | trackedObject | |
XRTrackedObject | sessionRelativeData |
Overrides
OnBeforeStart()
Sets the Object library on the subsystem before Start() is called on the base class.
Declaration
protected override void OnBeforeStart()
Overrides
OnTrackablesChanged(List<ARTrackedObject>, List<ARTrackedObject>, List<ARTrackedObject>)
Invokes the trackedObjectsChanged event.
Declaration
protected override void OnTrackablesChanged(List<ARTrackedObject> added, List<ARTrackedObject> updated, List<ARTrackedObject> removed)
Parameters
Type | Name | Description |
---|---|---|
List<ARTrackedObject> | added | A list of objects added this frame. |
List<ARTrackedObject> | updated | A list of objects updated this frame. |
List<ARTrackedObject> | removed | A list of objects removed this frame. |
Overrides
Events
trackedObjectsChanged
Invoked once per frame with information about the ARTrackedObjects that have changed, i.e., been added, updated, or removed.
This happens just before ARTrackedObjects are destroyed, so you can set ARTrackedObject.destroyOnRemoval
to false
from this event to suppress this behavior.
Declaration
public event Action<ARTrackedObjectsChangedEventArgs> trackedObjectsChanged
Event Type
Type | Description |
---|---|
Action<ARTrackedObjectsChangedEventArgs> |