Overview
XR Simulation lets you test your AR app in the Editor, simulating the behavior of an XR device as it moves through specially configured scenes called XR Simulation environments. With XR Simulation enabled, you can quickly test your AR app in a variety of environments without needing to build to a device or physically move to a different location.
XR Simulation runs the Simple AR sample, demonstrating plane detection in a living room environment
When you enter Play Mode with XR Simulation enabled, AR Foundation loads your XR Simulation environment into the scene with keyboard and mouse navigation controls. As you navigate the environment, AR Foundation detects trackables such as planes, images, and point clouds as if you were moving around in a real space.
AR Foundation includes a variety of preconfigured sample environments that you can optionally install and use, and you can also create your own environments.
You can currently test the following AR features using XR Simulation:
Feature | |
---|---|
Session | Yes |
Device tracking | Yes |
Camera | Yes |
Plane detection | Yes |
Image tracking | Yes |
Object tracking | |
Face tracking | |
Body tracking | |
Point clouds | Yes |
Raycasts | Yes |
Anchors | |
Meshing | Yes |
Environment Probes | |
Occlusion | |
Participants |
Architecture
AR Foundation defines its AR features using subsystems. Subsystem implementations are called providers. XR Simulation includes Editor-only providers for certain subsystems as shown above, allowing you test your app in Play Mode with no changes necessary to your scene or build settings.
Note
AR Foundation only uses the XR Simulation providers when you run your app in the Editor. The appropriate platform provider, such as the Google ARCore XR Plug-in on Android and the Apple ARKit XR Plug-in on iOS, is always used when you build and run on a device.
Limitations
XR Simulation has limitations you should consider when testing your app. Most importantly, while XR Simulation is designed to approximate the behavior of an XR device in various environments, simulations cannot exactly replicate device behavior and should not be considered a replacement for on-device testing. Unity recommends that you fully test your app on devices you intend to support, while XR Simulation allows you to more quickly iterate on some features without requiring a new build for each iteration.
The following AR features also have limitations in XR Simulation:
- Plane Detection: Planes are only detectable on axis-aligned surfaces.
- Meshing: Meshes are all detected immediately on entering Play Mode.