Class XRSessionSubsystem.Provider
The API this subsystem uses to interop with different provider implementations.
Namespace: UnityEngine.XR.ARSubsystems
Syntax
public class Provider
Properties
currentTrackingMode
Get the current tracking mode, e.g., the AnyTrackingMode bits.
Declaration
public virtual Feature currentTrackingMode { get; }
Property Value
Type | Description |
---|---|
Feature |
frameRate
The native update rate of the AR Session. Must be implemented if
supportsMatchFrameRate
is True
.
Declaration
public virtual int frameRate { get; }
Property Value
Type | Description |
---|---|
Int32 |
matchFrameRateEnabled
Whether the AR session update is synchronized with the Unity frame rate.
If true
, Update(XRSessionUpdateParams) will block until the next AR frame is available.
Declaration
public virtual bool matchFrameRateEnabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
matchFrameRateRequested
Whether the AR session update should be synchronized with the Unity frame rate.
If true
, Update(XRSessionUpdateParams) should block until the next AR frame is available.
Must be implemented if
supportsMatchFrameRate
is True
.
Declaration
public virtual bool matchFrameRateRequested { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
nativePtr
Get a pointer to an object associated with the session. Callers should be able to manipulate the session in their own code using this.
Declaration
public virtual IntPtr nativePtr { get; }
Property Value
Type | Description |
---|---|
IntPtr |
notTrackingReason
Get the NotTrackingReason for the session.
Declaration
public virtual NotTrackingReason notTrackingReason { get; }
Property Value
Type | Description |
---|---|
NotTrackingReason |
requestedFeatures
Should return the features requested by the enabling of other Subsystem
s.
Declaration
public virtual Feature requestedFeatures { get; }
Property Value
Type | Description |
---|---|
Feature |
requestedTrackingMode
Get or set the requested tracking mode, e.g., the AnyTrackingMode bits.
Declaration
public virtual Feature requestedTrackingMode { get; set; }
Property Value
Type | Description |
---|---|
Feature |
sessionId
Get a unique identifier for this session
Declaration
public virtual Guid sessionId { get; }
Property Value
Type | Description |
---|---|
Guid |
trackingState
Get the TrackingState for the session.
Declaration
public virtual TrackingState trackingState { get; }
Property Value
Type | Description |
---|---|
TrackingState |
Methods
Destroy()
Stop the session and destroy all associated resources.
Declaration
public virtual void Destroy()
GetAvailabilityAsync()
Get the session's availability, such as whether the platform supports XR.
Declaration
public virtual Promise<SessionAvailability> GetAvailabilityAsync()
Returns
Type | Description |
---|---|
Promise<SessionAvailability> | A Promise<T> that the caller can yield on until availability is determined. |
GetConfigurationDescriptors(Allocator)
This getter should allocate a new NativeArray
using allocator
and populate it with the supported ConfigurationDescriptors.
Declaration
public virtual NativeArray<ConfigurationDescriptor> GetConfigurationDescriptors(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | The |
Returns
Type | Description |
---|---|
NativeArray<ConfigurationDescriptor> | A newly allocated |
InstallAsync()
Attempt to update or install necessary XR software. Will only be called if supportsInstall is true.
Declaration
public virtual Promise<SessionInstallationStatus> InstallAsync()
Returns
Type | Description |
---|---|
Promise<SessionInstallationStatus> |
OnApplicationPause()
Invoked when the application is paused.
Declaration
public virtual void OnApplicationPause()
OnApplicationResume()
Invoked when the application is resumed.
Declaration
public virtual void OnApplicationResume()
Pause()
Invoked to pause a running session. This is different from OnApplicationPause().
Declaration
public virtual void Pause()
Reset()
Reset the session. The behavior should be equivalent to destroying and recreating the session.
Declaration
public virtual void Reset()
Resume()
Invoked to start or resume a session. This is different from OnApplicationResume().
Declaration
public virtual void Resume()
Update(XRSessionUpdateParams)
Perform any per-frame update logic here.
Declaration
public virtual void Update(XRSessionUpdateParams updateParams)
Parameters
Type | Name | Description |
---|---|---|
XRSessionUpdateParams | updateParams | Parameters about the current state that may be needed to inform the session. |
Update(XRSessionUpdateParams, Configuration)
Perform any per-frame update logic here. The session should use the configuration indicated by
configuration.descriptor.identifier.descriptor.identifier
, which should be one of the ones returned
by GetConfigurationDescriptors(Allocator).
Declaration
public virtual void Update(XRSessionUpdateParams updateParams, Configuration configuration)
Parameters
Type | Name | Description |
---|---|---|
XRSessionUpdateParams | updateParams | Parameters about the current state that may be needed to inform the session. |
Configuration | configuration | The configuration the session should use. |