Class XRSessionSubsystem | AR Subsystems | 3.0.0
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
    Object
    XRSubsystem<XRSessionSubsystemDescriptor>
    XRSessionSubsystem
    XRSessionSubsystemImpl
    Inherited Members
    XRSubsystem<XRSessionSubsystemDescriptor>.running
    XRSubsystem<XRSessionSubsystemDescriptor>.Destroy()
    XRSubsystem<XRSessionSubsystemDescriptor>.Start()
    XRSubsystem<XRSessionSubsystemDescriptor>.Stop()
    Namespace: UnityEngine.XR.ARSubsystems
    Syntax
    public abstract class XRSessionSubsystem : XRSubsystem<XRSessionSubsystemDescriptor>

    Constructors

    XRSessionSubsystem()

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

    Declaration
    public XRSessionSubsystem()

    Properties

    frameRate

    The native update rate of the AR Session.

    Declaration
    public int frameRate { get; }
    Property Value
    Type Description
    Int32
    Exceptions
    Type Condition
    NotSupportedException

    Thrown if supportsMatchFrameRate is False.

    matchFrameRate

    Whether the AR session update is synchronized with the Unity frame rate. If true, Update(XRSessionUpdateParams) should block until the next AR frame is available.

    Declaration
    public bool matchFrameRate { get; set; }
    Property Value
    Type Description
    Boolean
    Exceptions
    Type Condition
    NotSupportedException

    Thrown if supportsMatchFrameRate is False.

    nativePtr

    Returns an implementation-defined pointer associated with the session.

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

    notTrackingReason

    Gets the NotTrackingReason for the session.

    Declaration
    public NotTrackingReason notTrackingReason { get; }
    Property Value
    Type Description
    NotTrackingReason

    sessionId

    Returns a unique session identifier for this session.

    Declaration
    public Guid sessionId { get; }
    Property Value
    Type Description
    Guid

    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.Provider CreateProvider()
    Returns
    Type Description
    XRSessionSubsystem.Provider

    An implementation specific provider.

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

    OnDestroyed()

    Destroys the session.

    Declaration
    protected override sealed void OnDestroyed()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRSessionSubsystemDescriptor>.OnDestroyed()

    OnStart()

    Starts or resumes the session.

    Declaration
    protected override sealed void OnStart()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRSessionSubsystemDescriptor>.OnStart()

    OnStop()

    Pauses the session.

    Declaration
    protected override sealed void OnStop()
    Overrides
    UnityEngine.XR.ARSubsystems.XRSubsystem<UnityEngine.XR.ARSubsystems.XRSessionSubsystemDescriptor>.OnStop()

    Reset()

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

    Declaration
    public void Reset()

    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.

    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