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
Assembly: Unity.XR.ARFoundation.dll
Syntax
[DefaultExecutionOrder(-2147483647)]
[DisallowMultipleComponent]
[RequireComponent(typeof(XROrigin))]
public sealed class ARTrackedObjectManager : ARTrackableManager<XRObjectTrackingSubsystem, XRObjectTrackingSubsystemDescriptor, XRObjectTrackingSubsystem.Provider, 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 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
GetPrefab()
Get the Prefab to instantiate for each ARTrackedObject.
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject | The prefab to instantiate for each ARTrackedObject. |
Overrides
OnAfterSetSessionRelativeData(ARTrackedObject, XRTrackedObject)
Invoked just after each ARTrackedObject has been updated.
Declaration
protected override void OnAfterSetSessionRelativeData(ARTrackedObject trackedObject, XRTrackedObject sessionRelativeData)
Parameters
Type | Name | Description |
---|---|---|
ARTrackedObject | trackedObject | The ARTrackedObject being updated. |
XRTrackedObject | sessionRelativeData | New data associated with |
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 (that is, 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> |