Class ARSubsystemManager
Manages the lifecycle of multiple XR Subsystems specific to AR.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.ARFoundation
Syntax
public static class ARSubsystemManager
Remarks
The XR Subsystems provide direct access to the underlying data providers for a specific device. ARFoundation provides higher level abstractions and utilities on top of the low-level XR Subsystems, so, in general, you don't need to interact directly with the XR Subsystems.
A typical AR session may involve the following subsystems:
XRSessionSubsystemXRInputSubsystemXRCameraSubsystemXRDepthSubsystemXRPlaneSubsystemXRReferencePointSubsystemXRRaycastSubsystem
Properties
cameraSubsystem
Gets the XRCameraSubsystem. This subsystem provides access to camera data, such as ligt estimation information and the camera texture.
Declaration
public static XRCameraSubsystem cameraSubsystem { get; }
Property Value
| Type | Description |
|---|---|
| XRCameraSubsystem |
depthSubsystem
Gets the XRDepthSubsystem. This subsystem provides access to depth data, such as features points (aka point cloud).
Declaration
public static XRDepthSubsystem depthSubsystem { get; }
Property Value
| Type | Description |
|---|---|
| XRDepthSubsystem |
inputSubsystem
Gets the XRInputSubsystem. This allows Pose data from the device to be fed to the TrackedPoseDriver.
Declaration
public static XRInputSubsystem inputSubsystem { get; }
Property Value
| Type | Description |
|---|---|
| XRInputSubsystem |
lightEstimationRequested
Get or set whether light estimation should be enabled.
Declaration
public static bool lightEstimationRequested { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Note: You can only request light estimation. The underlying provider may not support light estimation.
planeSubsystem
Gets the XRPlaneSubsystem. This subsystem provides access to plane data, such as horizontal surfaces.
Declaration
public static XRPlaneSubsystem planeSubsystem { get; }
Property Value
| Type | Description |
|---|---|
| XRPlaneSubsystem |
raycastSubsystem
Gets the XRRaycastSubsystem. This subsystem provides access to the raycast interface.
Declaration
public static XRRaycastSubsystem raycastSubsystem { get; }
Property Value
| Type | Description |
|---|---|
| XRRaycastSubsystem |
referencePointSubsystem
Gets the XRReferencePointSubsystem. This subystem provides access to reference points, aka anchors.
Declaration
public static XRReferencePointSubsystem referencePointSubsystem { get; }
Property Value
| Type | Description |
|---|---|
| XRReferencePointSubsystem |
sessionState
The current state of the session. Use to query whether the session is running.
Declaration
public static ARSessionState sessionState { get; }
Property Value
| Type | Description |
|---|---|
| ARSessionState |
sessionSubsystem
Gets the XRSessionSubsystem. This controls the lifecycle of the AR Session.
Declaration
public static XRSessionSubsystem sessionSubsystem { get; }
Property Value
| Type | Description |
|---|---|
| XRSessionSubsystem |
TrackingState
Gets the current TrackingState.
Declaration
public static TrackingState TrackingState { get; }
Property Value
| Type | Description |
|---|---|
| TrackingState |
Methods
ARSubsystemsManager()
Static constructor for this static class. Creates the subsystems.
Declaration
public static void ARSubsystemsManager()
CreateSubsystems()
Creates each XR Subsystem associated with an AR session and registers their callbacks.
Declaration
public static void CreateSubsystems()
Remarks
"Creating" a subsystem means finding and initializing a plugin. It does not begin doing work until you call StartSubsystems().
DestroySubsystems()
Destroys each XR Subsystem associated with an AR session.
Declaration
public static void DestroySubsystems()
StartSubsystems()
Starts each of the XR Subsystems associated with AR session according to the requested options.
Declaration
public static Action StartSubsystems()
Returns
| Type | Description |
|---|---|
| Action | A timeout callback which can be invoked to indicate too much time has passed since requesting start. |
Remarks
Throws InvalidOperationException if there is no XRSessionSubsystem.
StopSubsystems()
Declaration
public static void StopSubsystems()
Events
cameraFrameReceived
This event is invoked whenever a new camera frame is provided by the device.
Declaration
public static event Action<ARCameraFrameEventArgs> cameraFrameReceived
Event Type
| Type | Description |
|---|---|
| Action<ARCameraFrameEventArgs> |
planeAdded
This event is invoked whenever a plane is added.
Declaration
public static event Action<PlaneAddedEventArgs> planeAdded
Event Type
| Type | Description |
|---|---|
| Action<PlaneAddedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful planeAdded.
planeRemoved
This event is invoked whenever an existing plane is removed.
Declaration
public static event Action<PlaneRemovedEventArgs> planeRemoved
Event Type
| Type | Description |
|---|---|
| Action<PlaneRemovedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful planeRemoved.
planeUpdated
This event is invoked whenever an existing plane is updated.
Declaration
public static event Action<PlaneUpdatedEventArgs> planeUpdated
Event Type
| Type | Description |
|---|---|
| Action<PlaneUpdatedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful planeUpdated.
pointCloudUpdated
This event is invoked whenever the point cloud has changed.
Declaration
public static event Action<PointCloudUpdatedEventArgs> pointCloudUpdated
Event Type
| Type | Description |
|---|---|
| Action<PointCloudUpdatedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful pointCloudUpdated.
referencePointUpdated
This event is invoked whenever a reference point changes.
Declaration
public static event Action<ReferencePointUpdatedEventArgs> referencePointUpdated
Event Type
| Type | Description |
|---|---|
| Action<ReferencePointUpdatedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful referencePointUpdated.
sessionStateChanged
This event is invoked whenever the ARSessionState changes.
Declaration
public static event Action<ARSessionStateChangedEventArgs> sessionStateChanged
Event Type
| Type | Description |
|---|---|
| Action<ARSessionStateChangedEventArgs> |
trackingStateChanged
This event is invoked whenever the TrackingState changes.
Declaration
public static event Action<ARTrackingStateChangedEventArgs> trackingStateChanged
Event Type
| Type | Description |
|---|---|
| Action<ARTrackingStateChangedEventArgs> |