The Snapdragon Spaces samples are using AR Foundation 4 because it is the default for Unity 2021 LTS. There should be no problems upgrading to ARFoundation 5 though.
Unity also provides a Migration guide to AR Foundation 5.
Updating the AR Foundation Package
- Modify the manifest.json file found in the project folder under Packages by adding the line "com.unity.xr.arfoundation": "5.0.7", to the list of dependencies.
- Open the Unity project, wait for it to recompile, then verify the update to AR Foundation 5 by opening the Package Manager setting its filter to Packages: Unity Registry then looking for the AR Foundation package version.
Switching from AR Session Origin to XR Session Origin
You will notice that the AR Session Origin component now shows a deprecation warning. It is internally already replaced by XR Origin and will provide the same functionality.
The following shows how to replace the AR Session Origin with the XR Session Origin:
- Open the sample scene that should be modified.
- Create an XR Origin in the scene by right clicking in the Hierarchy tab and navigating to XR > XR Origin (AR | VR).
- Make sure the XR Origin is centered at position (0, 0, 0).
- Depending on the application's needs, set the Tracking Origin Mode of the XR Origin to Device or Floor, and set the Camera Y offset to zero when choosing Device.
- Set the Y position of the Camera Offset Game Object to 0.
- Move the Interaction prefab from being a child of the AR Session Origin to XR Origin > Camera Offset.
- Make sure that the position and rotation of the Interaction prefab are set to zero.
- Delete the Left- and Right-Hand Controller
- Move or copy any other trackable managers located on or as children of the AR Session Origin or AR Camera to the XR Origin or Main Camera.
- Note that the binding references of the Tracked Pose Driver (Input System) on the Camera change from devicePosition [XR HMD] and . Delete the HandheldARInputDevice references.
- Delete the AR Session Origin and its children.
- Make sure that references to the trackable managers from the Sample Controller scripts aren't lost (usually under Sample Assets > [Scene Name] Sample Controller
- For the QCHT samples, look at the QCHT Sample - Menu scene that is already ARFoundation 5 enabled.