Class ARSubsystemManager | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class ARSubsystemManager

    Manages the lifecycle of multiple XR Subsystems specific to AR.

    Inheritance
    System.Object
    ARSubsystemManager
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    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:

    1. XRSessionSubsystem
    2. XRInputSubsystem
    3. XRCameraSubsystem
    4. XRDepthSubsystem
    5. XRPlaneSubsystem
    6. XRReferencePointSubsystem
    7. XRRaycastSubsystem
    Since there can only be a single AR session (and usually the associated subsystems), this class is a singleton.

    Properties

    availability

    Get the session availability. Use this to determine whether the device is supported.

    Declaration
    public static SessionAvailability availability { get; }
    Property Value
    Type Description
    SessionAvailability

    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

    systemState

    The state of the entire system. Use this to determine the status of AR availability and installation.

    Declaration
    public static SystemState systemState { get; }
    Property Value
    Type Description
    SystemState

    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()

    CheckAvailability()

    Start checking the availability of AR on the current device.

    Declaration
    public static IEnumerator CheckAvailability()
    Returns
    Type Description
    IEnumerator

    An IEnumerator used for a coroutine.

    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 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()

    Install()

    Begin installing AR software on the current device (if supported).

    Declaration
    public static IEnumerator Install()
    Returns
    Type Description
    IEnumerator

    An IEnumerator used for a coroutine.

    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>

    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>
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023