Session
This page is a supplement to the AR Foundation Session manual. The following sections only contain information about APIs where Meta Quest exhibits unique platform-specific behavior.
Tip
When developing an AR app, refer to both the AR Foundation documentation as well as the required packages for each platform you support.
Scene capture
Unlike other AR platforms, Meta OpenXR does not dynamically detect trackables at runtime. Instead, Meta's OpenXR runtime queries the device's Space Setup data and returns information stored in its Scene Model. In the Meta OpenXR API, this Space Setup process is referred to as scene capture.
During scene capture, the device presents an interface where users can label surfaces and objects in their environment such as walls and furniture. When scene capture is complete, the Scene Model is saved to the device and persists across applications and sessions.
Scene capture shown on a Quest 3.
Note
The user interface for scene capture varies depending on which Meta Quest device is used, but all devices support the same OpenXR API.
The user can initiate scene capture any time via the Space Setup option in Settings, and your app can also initiate scene capture any time via the scene capture API.
Tip
Due to current limitations of tracking technology, it is possible that detected planes and other trackables can become misaligned with their physical counterparts over the duration of an AR session. As a workaround for this issue, you can give users the option to initiate scene capture from within your app, allowing them to realign the bounding boxes of trackables in their space.
Life cycle
The scene capture life cycle consists of four phases:
- You request to initiate scene capture.
- If the request was successful, on a subsequent frame Unity invokes MonoBehaviour.OnApplicationPause(bool), passing
true
. Your app is suspended during scene capture. - The user completes scene capture as prompted by the device.
- Unity resumes and invokes
OnApplicationPause
again, passingfalse
.
Code sample
Use MetaOpenXRSessionSubsystem.TryRequestSceneCapture to initiate scene capture, as shown below:
// Getting a reference to the ARSession at runtime is not optimal.
// For better runtime performance, reuse a saved reference to the ARSession instead
var arSession = Object.FindAnyObjectByType<ARSession>();
// To access the scene capture API,
// cast the ARSession's subsystem to MetaOpenXRSessionSubsystem
var success = (arSession.subsystem as MetaOpenXRSessionSubsystem)
.TryRequestSceneCapture();