Class XRSessionExtensions
Provides extensions to the XRSessionSubsystem.
Inheritance
Inherited Members
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 |
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 |
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 |
Returns
| Type | Description |
|---|---|
| IntPtr | An |
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 |
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 |
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.