# Unity Setup Guide

This guide will explain in detail how to get started with the Snapdragon Spaces SDK in Unity.

# Prerequisites


Please note that the recommended Unity Editor version to work with Snapdragon Spaces is 2020.3.17f1. Later versions of Unity Editor might work well, but have not been extensively tested. Version 2020.3.35f1 or higher is required, if MRTK3 (opens new window) is an additional requirement.

Android Build Support must be added when installing the Unity Editor to be able to export .apk files. The module can also be added afterwards through the Unity Hub.

# Import the package

The Snapdragon Spaces SDK comes as a package in form of a tarball file. Ext Please follow the Unity instructions (opens new window) to import the package into the project using the tgz file located in the Unity Package folder.


After importing the package, Unity might prompt you to enable the new input system. Click Yes to ensure full functionality with the OpenXR and XR Interaction Toolkit packages. If the old input system is needed in addition, the Active Input Handling value under Player > Other Settings > Configuration can be set to both.

Unity Input System prompt

# Import the samples

The Snapdragon Spaces SDK package comes with sample assets to showcase how to use the services included in the package. To import them, simply pick the package in the package manager (located in the menu bar under Window > Package Manager) and click import on the Core Samples.

Import Core Samples

After the samples have been imported, there is a helper tool to add the sample scenes to the build settings by clicking Window > Snapdragon Spaces > Add Scenes to Build Settings in the menu bar.

Add scenes to the Editor build settings

# Change the project settings

To enable the Snapdragon Spaces OpenXR Plug-in, navigate to the project settings under Edit > Project Settings > XR Plug-in Management and open the Android tab. Check the OpenXR plug-in as well as the Snapdragon Spaces feature group. Initially, there will be some project settings that have to be updated/fixed. To do so, click on the red exclamation mark next to OpenXR to step into the OpenXR Project Validation window. Click on the fix buttons next to the entries to apply the needed project settings. Apply the setting to enable both Input Systems last, as this may require a restart of the Editor.

OpenXR Project Validation

# Enable Spaces features

Enable the features in the OpenXR settings that should be active during runtime. The current supported features and the respective AR Foundation manager or XR subsystem that can be used with it, is listed in the table below.

Feature AR Foundation/Spaces Manager XR Subsystem
Base Runtime AR Session (opens new window)
AR Pose Driver (opens new window)
XRSessionSubsystem (opens new window)
Spatial Anchors AR Anchor Manager (opens new window) XRAnchorSubsystem (opens new window)
Plane Detection AR Plane Manager (opens new window) XRPlaneSubsystem (opens new window)
Image Tracking AR Tracked Image Manager (opens new window) XRImageTrackingSubsystem (opens new window)
Hit Testing AR Raycast Manager (opens new window) XRRaycastSubsystem (opens new window)
Hand Tracking Spaces Hand Tracking Manager Spaces.XRHandTrackingSubsystem
OpenXR Project Features

# Custom Controller Setup

The Snapdragon Spaces Unity package includes the possibility to spawn a controller upon startup of the application on the host device. This feature is enabled by default in the BaseRuntimeFeature, which is located under Edit > Project Settings > XR Plug-in Management > OpenXR > OpenXR Feature Groups > BaseRuntimeFeature (by clicking on the cog wheel).

If a custom implementation with different appearance and slightly different functionality is desired, an alternative controller archive can be build in the steps described in the custom controller section.

The resulting archive from these steps can then be included anywhere in the Assets folder of the Unity project, and the Use Custom Controller toggle has to be enabled (which requires the Launch Controller On Host option to be enabled as well).

Custom controller setting in BaseRuntimeFeature setting panel


In some instances, adding a custom controller archive might lead to Gradle caching errors. In that case, removing the temporary Gradle project folder generated in the project folder under Temp > gradleOut might resolve the issue.

# Adding a new Interaction Profile

To use an interaction profile different from the ones included in the Snapdragon Spaces plugin, it must be added in the project. To add a new interaction profile in Unity, it should be added in Project Settings > XR Plug-in Management > OpenXR > Interaction Profiles. Then you can configure the corresponding input actions with the inputs of the new profile.

Interaction profiles section