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

    Class XRSessionSubsystem

    This subsystem controls the lifecycle of an XR session. Some platforms, particularly those that have non-XR modes, need to be able to turn the session on and off to enter and exit XR mode(s) of operation.

    Inheritance
    System.Object
    XRSessionSubsystem
    XRSessionSubsystemImpl
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public abstract class XRSessionSubsystem : Subsystem<XRSessionSubsystemDescriptor>

    Constructors

    XRSessionSubsystem()

    Do not call this directly. Call create on a valid XRSessionSubsystemDescriptor instead.

    Declaration
    public XRSessionSubsystem()

    Fields

    m_Running

    Implementing classes must set this value to reflect the running state of the subsystem

    Declaration
    protected bool m_Running
    Field Value
    Type Description
    System.Boolean

    Properties

    nativePtr

    Returns an implementation-defined pointer associated with the session.

    Declaration
    public IntPtr nativePtr { get; }
    Property Value
    Type Description
    System.IntPtr

    running

    Whether the session is currently running.

    Declaration
    public override bool running { get; }
    Property Value
    Type Description
    System.Boolean

    trackingState

    Gets the TrackingState for the session.

    Declaration
    public TrackingState trackingState { get; }
    Property Value
    Type Description
    TrackingState

    Methods

    CreateProvider()

    Implement this to provide this class with an interface to platform specific implementations.

    Declaration
    protected abstract XRSessionSubsystem.IProvider CreateProvider()
    Returns
    Type Description
    XRSessionSubsystem.IProvider

    An implementation specific provider.

    Destroy()

    Destroys the session.

    Declaration
    public override void Destroy()

    GetAvailabilityAsync()

    Asynchronously retrieves the SessionAvailability. Used to determine whether the current device supports XR and if the necessary software is installed.

    Declaration
    public Promise<SessionAvailability> GetAvailabilityAsync()
    Returns
    Type Description
    Promise<SessionAvailability>

    A Promise<T> which can be used to determine when the availability has been determined and retrieve the result.

    Remarks

    This platform-agnostic method is typically implemented by a platform-specific package.

    InstallAsync()

    Asynchronously attempts to install XR software on the current device. Throws if supportsInstall is false.

    Declaration
    public Promise<SessionInstallationStatus> InstallAsync()
    Returns
    Type Description
    Promise<SessionInstallationStatus>

    A Promise<T> which can be used to determine when the installation completes and retrieve the result.

    Remarks

    This platform-agnostic method is typically implemented by a platform-specific package.

    OnApplicationPause()

    Should be invoked when the application is paused.

    Declaration
    public void OnApplicationPause()

    OnApplicationResume()

    Should be invoked when the application is resumed.

    Declaration
    public void OnApplicationResume()

    Reset()

    Restarts a session. Stop() and Start() pause and resume a session, respectively. Restart resets the session state and clears and any detected trackables.

    Declaration
    public void Reset()

    Start()

    Starts or resumes the session.

    Declaration
    public override void Start()

    Stop()

    Pauses the session.

    Declaration
    public override void Stop()

    Update(XRSessionUpdateParams)

    Trigger the session's update loop.

    Declaration
    public void Update(XRSessionUpdateParams updateParams)
    Parameters
    Type Name Description
    XRSessionUpdateParams updateParams

    Data needed by the session to perform its update.

    In This Article
    • Constructors
      • XRSessionSubsystem()
    • Fields
      • m_Running
    • Properties
      • nativePtr
      • running
      • trackingState
    • Methods
      • CreateProvider()
      • Destroy()
      • GetAvailabilityAsync()
      • InstallAsync()
      • OnApplicationPause()
      • OnApplicationResume()
      • Reset()
      • Start()
      • Stop()
      • Update(XRSessionUpdateParams)
    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