Class XRObjectTrackingSubsystem
Base class for object tracking subsystems.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public class XRObjectTrackingSubsystem : TrackingSubsystem<XRTrackedObject, XRObjectTrackingSubsystem, XRObjectTrackingSubsystemDescriptor, XRObjectTrackingSubsystem.Provider>, ISubsystem
Remarks
This subsystem allows real objects to be recognized in the environment. You must first specify a library of "reference objects" to search for. These reference objects are typically in a format specific to a particular implementation; see the documentation for the implementing subsystem for further instructions.
Constructors
XRObjectTrackingSubsystem()
Constructs an object tracking subsystem. Do not invoked directly; call Create
on the XRObjectTrackingSubsystemDescriptor instead.
Declaration
public XRObjectTrackingSubsystem()
Properties
library
The library of reference objects for which to scan. This must be set to non-null before calling OnStart().
Declaration
public XRReferenceObjectLibrary library { get; set; }
Property Value
Type | Description |
---|---|
XRReferenceObjectLibrary |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if you set the library to |
Methods
GetChanges(Allocator)
Get changes to XRTrackedObjects (added, updated, and removed) since
the last call to this method. The caller owns the memory allocated with allocator
.
Declaration
public sealed override TrackableChanges<XRTrackedObject> GetChanges(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Unity.Collections.Allocator | allocator | The allocator to use for the returned arrays of changes. |
Returns
Type | Description |
---|---|
TrackableChanges<XRTrackedObject> | A new TrackableChanges<T> allocated with |
Overrides
OnStart()
Starts scanning for the reference objects in library.
Declaration
protected sealed override void OnStart()
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown if library is |
OnStop()
Stops scanning for objects.
Declaration
protected sealed override void OnStop()
Overrides
Register<T>(String, XRObjectTrackingSubsystemDescriptor.Capabilities)
Registers an implementation of the XRObjectTrackingSubsystem.
Declaration
public static void Register<T>(string id, XRObjectTrackingSubsystemDescriptor.Capabilities capabilities)
where T : XRObjectTrackingSubsystem.Provider
Parameters
Type | Name | Description |
---|---|---|
String | id | A unique string identifying the subsystem implementation. |
XRObjectTrackingSubsystemDescriptor.Capabilities | capabilities | Describes the capabilities of the implementation. |
Type Parameters
Name | Description |
---|---|
T | The concrete type of the subsystem being registered. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Register<TProvider, TSubsystemOverride>(String, XRObjectTrackingSubsystemDescriptor.Capabilities)
Registers a new implementation of the XRObjectTrackingSubsystem.
Allows overriding a derived type of XRObjectTrackingSubsystem
.
Declaration
public static void Register<TProvider, TSubsystemOverride>(string id, XRObjectTrackingSubsystemDescriptor.Capabilities capabilities)
where TProvider : XRObjectTrackingSubsystem.Provider where TSubsystemOverride : XRObjectTrackingSubsystem
Parameters
Type | Name | Description |
---|---|---|
String | id | A unique string identifying the subsystem implementation. |
XRObjectTrackingSubsystemDescriptor.Capabilities | capabilities | Describes the capabilities of the implementation. |
Type Parameters
Name | Description |
---|---|
TProvider | The concrete type of the provider being registered. |
TSubsystemOverride | The concrete type of the subsystem being registered. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |