What’s New in AR Foundation 5.0
Version 5.0 of AR Foundation is here and comes with several changes and new features. AR Foundation 5.0 works with Unity 2021LTS, Unity 2022.1 and is available in beta with Unity 2022.2.
Changes
- AR Session Origin is now deprecated and replaced by XR Origin, which is suitable for both AR and VR applications. XR Origin is part of the XR Core Utilities package, a new dependency of AR Foundation.
- The AR Subsystems package (com.unity.xr.arsubsystems) has been merged into com.unity.xr.arfoundation.
For more information on migrating your project to 5.0, see the AR Foundation migration documentation.
New Features
- XR Simulation allows you to run your AR app in Play mode by simulating an AR device, no longer requiring you to rebuild your app to test changes.
- AR Debug Menu is a new Prefab you can use to view available configurations on your device and visualize AR subsystem data such as planes and point cloud positions.
Requirements
- AR Foundation 5.0 requires Unity 2021LTS and later.
XR Simulation
AR Foundation can simulate an AR device, allowing the testing of AR enabled scenes in the Editor. In play mode you can navigate around a variety of simulated environments detecting planes, tracked images, etc. as if you are using a real device. You can also create your own environments to use in the simulation.
The following AR Foundation features are supported:
Enable simulation
Go to Project Settings > XR Plug-in Management > Windows, Mac, Linux and enable XR Simulation. When you enter Play Mode in the editor with a scene that contains an ARSession, a simulated environment is loaded. Click the right mouse button in the Game view to look around and press the W, A, S, and D keys to navigate around the environment.
As you navigate around the environment, AR Foundation discovers features of the simulated environment as if you were navigating around a real space. However, there are a few differences compared to using a real device:
- Planes: Planes are only discovered on axis aligned surfaces.
- Meshes: Meshes are all discovered immediately on entering play mode.
- Tracked images: Any tagged image in the simulation environment can be tracked regardless of what images are in your reference library. This allows testing without having to modify either your reference image library or the environment.
For more in-depth information on how to set up and work with AR Simulation, please refer to the AR Foundation Simulation documentation. You can also watch a tutorial from AR Content Creator and Founder of LearnXR, Dilmer Valecillos, on YouTube.
Unity Mars and Simulation
Unity Mars includes a simulation feature that can work with AR Foundation. Unity Mars’ Simulation System supports the same features as AR Foundation and more. We recommend that Unity Mars developers continue with Unity Mars simulation. Note that both Simulations features cannot be used at the same time.
XR Origin
ARSessionOrigin is now deprecated and is replaced by XROrigin. The XR Origin represents the center of worldspace in an XR scene. The purpose of the XR Origin is to transform objects and trackable features to their final position, orientation, and scale in the Unity scene. It specifies an Origin, a Camera Floor Offset Object, and a Camera.
For more information on migrating ARSessionOrigin to XROrigin, see the AR Foundation migration documentation.
AR Debug Menu
You can add the AR Foundation Debug Menu to an AR scene to visualize tracking information and available configurations. When that scene is active on a target device, you can use the menu to view the following information:
-
Stats Info
-
FPS
-
Tracking Mode
-
Session Configurations
-
Debug Options
-
XR Origin
-
Planes
-
Anchors
-
Point Clouds
The AR Debug menu works with any scene that contains an ARSession, an XROrigin, and a Camera.
The Debug menu is a Prefab object containing the ARDebugMenu script and a set of GameObjects and components that provide the UI. See Setting up the menu for instructions to add the Debug menu to a scene.
Setting up the menu
To create an out-of-the-box fully configured debug menu, right-click anywhere in the Hierarchy window and select XR > AR Debug Menu.
The AR Debug menu appears as a toolbar that is anchored either to the left or bottom side of the screen.
Stats Info
The Stats Info tab provides general information about a session, including current FPS and TrackingMode.
Session Configurations
The Session Configurations tab displays all the available session Configurations for a specific platform and highlights the currently active configuration.
Debug Options
The Debug Options tab allows the user to toggle visualizers for various ARTrackables in the scene.