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

    Class XRSessionExtensions

    Provides extensions to the XRSessionSubsystem.

    Inheritance
    System.Object
    XRSessionExtensions
    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.ARExtensions
    Syntax
    public static class XRSessionExtensions

    Methods

    ActivateExtensions(XRSessionSubsystem)

    For internal use. Sets the active subsystem whose extension methods should be used.

    Declaration
    public static void ActivateExtensions(this XRSessionSubsystem sessionSubsystem)
    Parameters
    Type Name Description
    XRSessionSubsystem sessionSubsystem

    The XRSessionSubsystem being extended.

    GetAvailabilityAsync(XRSessionSubsystem)

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

    Declaration
    public static Promise<SessionAvailability> GetAvailabilityAsync(this XRSessionSubsystem sessionSubsystem)
    Parameters
    Type Name Description
    XRSessionSubsystem sessionSubsystem

    The XRSessionSubsystem to extend.

    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.

    GetNativePtr(XRSessionSubsystem)

    Retrieves a native IntPtr associated with the XRSessionSubsystem. Note: This is for advanced usage or access to platform-specific features not exposed by the existing API.

    Declaration
    public static IntPtr GetNativePtr(this XRSessionSubsystem sessionSubsystem)
    Parameters
    Type Name Description
    XRSessionSubsystem sessionSubsystem

    The XRSessionSubsystem to extend.

    Returns
    Type Description
    IntPtr

    An IntPtr associated with the platform-specific session.

    InstallAsync(XRSessionSubsystem)

    Asynchronously attempts to install AR software on the current device.

    Declaration
    public static Promise<SessionInstallationStatus> InstallAsync(this XRSessionSubsystem sessionSubsystem)
    Parameters
    Type Name Description
    XRSessionSubsystem sessionSubsystem

    The XRSessionSubsystem to extend.

    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.

    RegisterGetAvailabilityAsyncHandler(String, XRSessionExtensions.AsyncDelegate<SessionAvailability>)

    Registers a handler for an asynchronous AR availability check. See GetAvailabilityAsync(XRSessionSubsystem).

    Declaration
    public static void RegisterGetAvailabilityAsyncHandler(string subsystemId, XRSessionExtensions.AsyncDelegate<SessionAvailability> handler)
    Parameters
    Type Name Description
    System.String subsystemId

    The string name associated with the package's session subsystem.

    XRSessionExtensions.AsyncDelegate<SessionAvailability> handler

    An XRSessionExtensions.AsyncDelegate<T> to handle the request.

    Remarks

    A platform-specific package should implement an installation handler and register it using this method.

    RegisterGetNativePtrHandler(String, Func<XRSessionSubsystem, IntPtr>)

    Registers a handler for retrieving a platform-specific IntPtr associated with the session.

    Declaration
    public static void RegisterGetNativePtrHandler(string subsystemId, Func<XRSessionSubsystem, IntPtr> handler)
    Parameters
    Type Name Description
    System.String subsystemId

    The string name associated with the package's session subsystem.

    Func<XRSessionSubsystem, IntPtr> handler

    The delegate which returns an IntPtr associated with the session.

    Remarks

    A platform-specific package should implement a method to get a native ptr and register it using this method.

    RegisterInstallAsyncHandler(String, XRSessionExtensions.AsyncDelegate<SessionInstallationStatus>)

    Registers a handler for asynchronous AR software installation. See InstallAsync(XRSessionSubsystem).

    Declaration
    public static void RegisterInstallAsyncHandler(string subsystemId, XRSessionExtensions.AsyncDelegate<SessionInstallationStatus> handler)
    Parameters
    Type Name Description
    System.String subsystemId

    The string name associated with the package's session subsystem.

    XRSessionExtensions.AsyncDelegate<SessionInstallationStatus> handler

    An XRSessionExtensions.AsyncDelegate<T> to handle the request.

    Remarks

    A platform-specific package should implement an installation handler and register it using this method.

    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