Class ARSessionFeature
Enables AR Foundation session support via OpenXR for Meta Quest devices.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Features.Meta
Assembly: Unity.XR.MetaOpenXR.dll
Syntax
[OpenXRFeature(UiName = "Meta Quest: AR Session", BuildTargetGroups = new BuildTargetGroup[] { BuildTargetGroup.Android, BuildTargetGroup.Standalone }, Company = "Unity Technologies", Desc = "AR Foundation support on Meta Quest devices. Required as a dependency of any other AR feature.", DocumentationLink = "https://docs.unity3d.com/Packages/com.unity.xr.meta-openxr@1.0/manual/features/session.html", OpenxrExtensionStrings = "XR_FB_scene_capture", Category = "Feature", FeatureId = "com.unity.openxr.feature.arfoundation-meta-session", Version = "0.1.0")]
public class ARSessionFeature : OpenXRFeature
Fields
featureId
The feature id string. This is used to give the feature a well known id for reference.
Declaration
public const string featureId = "com.unity.openxr.feature.arfoundation-meta-session"
Field Value
| Type | Description |
|---|---|
| string |
Methods
HookGetInstanceProcAddr(IntPtr)
Called to hook xrGetInstanceProcAddr. Returning a different function pointer allows intercepting any OpenXR method.
Declaration
protected override IntPtr HookGetInstanceProcAddr(IntPtr func)
Parameters
| Type | Name | Description |
|---|---|---|
| IntPtr | func | xrGetInstanceProcAddr native function pointer |
Returns
| Type | Description |
|---|---|
| IntPtr | Function pointer that Unity will use to look up OpenXR native functions. |
Overrides
OnAppSpaceChange(ulong)
Called when the reference xrSpace for the app changes.
Declaration
protected override void OnAppSpaceChange(ulong xrSpace)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrSpace | Handle of the xrSpace |
Overrides
OnInstanceCreate(ulong)
Called after xrCreateInstance.
Declaration
protected override bool OnInstanceCreate(ulong xrInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrInstance | Handle of the xrInstance |
Returns
| Type | Description |
|---|---|
| bool | Returns |
Overrides
OnInstanceDestroy(ulong)
Called before xrDestroyInstance
Declaration
protected override void OnInstanceDestroy(ulong xrInstance)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrInstance | Handle of the xrInstance |
Overrides
OnSessionCreate(ulong)
Called after xrCreateSession.
Declaration
protected override void OnSessionCreate(ulong xrSession)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrSession | Handle of the xrSession |
Overrides
OnSessionDestroy(ulong)
Called before xrDestroySession.
Declaration
protected override void OnSessionDestroy(ulong xrSession)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrSession | Handle of the xrSession |
Overrides
OnSessionStateChange(int, int)
Called when the OpenXR loader receives the XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED event
from the runtime signaling that the XrSessionState has changed.
Declaration
protected override void OnSessionStateChange(int oldState, int newState)
Parameters
| Type | Name | Description |
|---|---|---|
| int | oldState | Previous state |
| int | newState | New state |
Overrides
OnSubsystemCreate()
Instantiates Meta OpenXR Session subsystem instance, but does not start it. (Start/Stop is typically handled by AR Foundation managers.)
Declaration
protected override void OnSubsystemCreate()
Overrides
OnSubsystemDestroy()
Destroys the session subsystem.
Declaration
protected override void OnSubsystemDestroy()
Overrides
OnSystemChange(ulong)
Called after xrGetSystem.
Declaration
protected override void OnSystemChange(ulong xrSystem)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrSystem | Handle of the xrSystemId |