Class ARTrackedImageManager
A manager for ARTrackedImages. Uses the XRImageTrackingSubsystem
to recognize and track 2D images in the physical environment.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
public sealed class ARTrackedImageManager : ARTrackableManager<XRImageTrackingSubsystem, XRImageTrackingSubsystemDescriptor, XRTrackedImage, ARTrackedImage>
Properties
gameObjectName
The name to be used for the GameObject
whenever a new image is detected.
Declaration
protected override string gameObjectName { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
maxNumberOfMovingImages
The maximum number of moving images to track in realtime. Support may vary between devices and providers. Check
for support at runtime with .SubsystemDescriptor.supportsMovingImages
.
Declaration
public int maxNumberOfMovingImages { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
referenceLibrary
The XRReferenceImageLibrary
to use during image detection. This is the
library of images which will be detected and/or tracked in the physical environment.
Declaration
public XRReferenceImageLibrary referenceLibrary { get; set; }
Property Value
Type | Description |
---|---|
XRReferenceImageLibrary |
trackedImagePrefab
If not null, instantiates this prefab for each detected image.
Declaration
public GameObject trackedImagePrefab { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Methods
Awake()
Initializes private members.
Declaration
protected override void Awake()
Overrides
GetPrefab()
Declaration
protected override GameObject GetPrefab()
Returns
Type | Description |
---|---|
GameObject |
Overrides
OnAfterSetSessionRelativeData(ARTrackedImage, XRTrackedImage)
Declaration
protected override void OnAfterSetSessionRelativeData(ARTrackedImage image, XRTrackedImage sessionRelativeData)
Parameters
Type | Name | Description |
---|---|---|
ARTrackedImage | image | |
XRTrackedImage | sessionRelativeData |
Overrides
OnBeforeStart()
Sets the image library on the subsystem before Start() is called on the XRImageTrackingSubsystem
.
Declaration
protected override void OnBeforeStart()
Overrides
OnTrackablesChanged(List<ARTrackedImage>, List<ARTrackedImage>, List<ARTrackedImage>)
Invokes the trackedImagesChanged event.
Declaration
protected override void OnTrackablesChanged(List<ARTrackedImage> added, List<ARTrackedImage> updated, List<ARTrackedImage> removed)
Parameters
Type | Name | Description |
---|---|---|
List<ARTrackedImage> | added | A list of images added this frame. |
List<ARTrackedImage> | updated | A list of images updated this frame. |
List<ARTrackedImage> | removed | A list of images removed this frame. |
Overrides
Events
trackedImagesChanged
Invoked once per frame with information about the ARTrackedImages that have changed, i.e., been added, updated, or removed.
This happens just before ARTrackedImages are destroyed, so you can set ARTrackedImage.destroyOnRemoval
to false
from this event to suppress this behavior.
Declaration
public event Action<ARTrackedImagesChangedEventArgs> trackedImagesChanged
Event Type
Type | Description |
---|---|
Action<ARTrackedImagesChangedEventArgs> |