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:
XRSessionSubsystem
XRInputSubsystem
XRCameraSubsystem
XRDepthSubsystem
XRPlaneSubsystem
XRReferencePointSubsystem
XRRaycastSubsystem
Properties
cameraFocusMode
Get or set the CameraFocusMode
to use on the physica AR camera.
Declaration
public static CameraFocusMode cameraFocusMode { get; set; }
Property Value
Type | Description |
---|---|
CameraFocusMode |
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 |
faceSubsystem
Gets the XRFaceSubsystem
. This subsystem provides access to the face tracking interface.
Declaration
public static XRFaceSubsystem faceSubsystem { get; }
Property Value
Type | Description |
---|---|
XRFaceSubsystem |
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.
planeDetectionFlags
Get or set the plane detection flags, used to specify which type of plane detection to enable, e.g., horizontal, vertical, or both.
Declaration
public static PlaneDetectionFlags planeDetectionFlags { get; set; }
Property Value
Type | Description |
---|---|
PlaneDetectionFlags |
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 |
sessionSubsystem
Gets the XRSessionSubsystem
. This controls the lifecycle of the AR Session.
Declaration
public static XRSessionSubsystem sessionSubsystem { get; }
Property Value
Type | Description |
---|---|
XRSessionSubsystem |
subsystemFilter
Allows to filter subsystem ids and initialize first one containing specified string.
Declaration
public static string subsystemFilter { get; set; }
Property Value
Type | Description |
---|---|
System.String |
systemState
The state of the entire system. Use this to determine the status of AR availability and installation.
Declaration
public static ARSystemState systemState { get; }
Property Value
Type | Description |
---|---|
ARSystemState |
Methods
CheckAvailability()
Start checking the availability of AR on the current device.
Declaration
public static IEnumerator CheckAvailability()
Returns
Type | Description |
---|---|
IEnumerator | An |
Remarks
The availability check may be asynchronous, so this is implemented as a coroutine. It is safe to call this multiple times; if called a second time while an availability check is being made, it returns a new coroutine which waits on the first.
CreateSubsystems()
Creates each XR Subsystem associated with an AR session.
Declaration
public static void CreateSubsystems()
DestroySubsystems()
Destroys each XR Subsystem associated with an AR session.
Declaration
public static void DestroySubsystems()
Install()
Begin installing AR software on the current device (if supported).
Declaration
public static IEnumerator Install()
Returns
Type | Description |
---|---|
IEnumerator | An |
Remarks
Installation may be asynchronous, so this is implemented as a coroutine. It is safe to call this multiple times; if called a second time while an installation is in process, it returns a new coroutine which waits on the first.
StartSubsystems()
Starts each of the XR Subsystems associated with AR session according to the requested options.
Declaration
public static void StartSubsystems()
Remarks
Throws InvalidOperationException
if there is no XRSessionSubsystem
.
StopSubsystems()
Stops all the XR Subsystems associated with the AR session.
Declaration
public static void StopSubsystems()
Remarks
"Stopping" an AR session does not destroy the session. A call to StopSubsystems() followed by StartSubsystems() is similar to "pause" and "resume". To completely destroy the current AR session and begin a new one, you must first DestroySubsystems().
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> |
faceAdded
This event is invoked whenever a face is added.
Declaration
public static event Action<FaceAddedEventArgs> faceAdded
Event Type
Type | Description |
---|---|
Action<FaceAddedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful faceAdded.
Face tracking is disabled if there are no subscribers to at least one of faceAdded, faceUpdated, or faceRemoved.
faceRemoved
This event is invoked whenever an existing face is removed.
Declaration
public static event Action<FaceRemovedEventArgs> faceRemoved
Event Type
Type | Description |
---|---|
Action<FaceRemovedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful faceRemoved.
Face tracking is disabled if there are no subscribers to at least one of faceAdded, faceUpdated, or faceRemoved.
faceUpdated
This event is invoked whenever an existing face is updated.
Declaration
public static event Action<FaceUpdatedEventArgs> faceUpdated
Event Type
Type | Description |
---|---|
Action<FaceUpdatedEventArgs> |
Remarks
This is the low-level XR interface, and the data is in session space. Consider instead subscribing to the more useful faceUpdated.
Face tracking is disabled if there are no subscribers to at least one of faceAdded, faceUpdated, or faceRemoved.
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.
Plane detection is disabled if there are no subscribers to at least one of planeAdded, planeUpdated, or planeRemoved.
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.
Plane detection is disabled if there are no subscribers to at least one of planeAdded, planeUpdated, or 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.
Plane detection is disabled if there are no subscribers to at least one of planeAdded, planeUpdated, or planeRemoved.
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.
Point clouds are disabled if there are no subscribes to this event.
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.
sessionDestroyed
This event is invoked whenever the sessionSubsystem is destroyed.
Declaration
public static event Action sessionDestroyed
Event Type
Type | Description |
---|---|
Action |
systemStateChanged
This event is invoked whenever the systemState changes.
Declaration
public static event Action<ARSystemStateChangedEventArgs> systemStateChanged
Event Type
Type | Description |
---|---|
Action<ARSystemStateChangedEventArgs> |