# Unreal Engine Setup Guide

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

# Prerequisites

Please note that the Snapdragon Spaces SDK currently supports the Unreal Engine Editor version 4.27 and Windows as the development platform. Unfortunately, the plugin doesn't support Unreal Engine 5, and OpenXR in Unreal Editor only supports Win64.

Android Build Support must be added when installing the Unreal Engine to be able to export .apk files. Please follow the Unreal instructions (opens new window) for setting up Android SDK and NDK.

# Step 1: Create a project

To create a new Unreal Engine project, follow the steps in the Setting Up a Blank Project article of the Unreal documentation for AR projects (opens new window). Please, if you are importing our sample, ignore the Adding a Pawn and Game Mode and Creating an AR Session sections.

# Step 2: Import the plugin

To import the Snapdragon Spaces plugin into your engine, simply extract the SnapdragonSpaces folder from SnapdragonSpaces_Plugin archive to the Engine/Plugins/Marketplace folder in the engine installation path.

Engine plugins installation path

WARNING

If the Marketplace folder isn't created in your Engine, you can create it inside the Plugins folder, and then copy de SnapdragonSpaces folder. Please note that Unreal only detects the plugin if the suggested path is respected.

# Step 3: Import the samples

To import the Snapdragon Spaces Samples into your project, simply open the SnapdragonSpaces_Samples zip file and copy the Config and Content folders to the root of your project, overwriting your existing files. Content sub-folders include folders for the samples, along with a common folder. The common folder includes the base blueprints for using the AR devices correctly.

# Step 4: Change the project settings

To enable the Snapdragon Spaces OpenXR plugin, navigate to the project settings under Edit > Plugins > Mixed Reality and enable the SnapdragonSpaces plugin.

Enable the Snapdragon Spaces plugin

Under Edit > Plugins > Virtual Reality, check if the OpenXR plugin is enabled as well.

Check the OpenXR plugin is enabled

Some settings are mandatory to build a package. Please, check if your project is properly configured under Project Settings > Snapdragon Spaces.

Snapdragon Spaces plugin settings

Here is a description of the points in the screenshot:

  1. Refresh the verification of the settings. Please, do it after applying the changes from this tab.
  2. Shows an error message, when there is an issue with the enabled extensions.
  3. Shows the extensions that can be enabled.
  4. Shows error and warning messages with the project settings.
  5. Shows the mandatory settings. All these options have to be enabled in order to proceed with the build.
  6. Shows the recommended settings for better performance.

# Optional: Custom Controller Setup

The Snapdragon Spaces Unreal Engine plugin includes the possibility to spawn a controller upon startup of the application on the host device. This feature is enabled by default in the plugin settings, which is located under Edit > Project Settings > Plugins > Snapdragon Spaces (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 linked in the project settings. The Use Custom Controller toggle has to be enabled (which requires the Launch Controller On Host option to be enabled as well) so that a path to the alternative controller archive can be selected.

# Optional: Adding a new Interaction Profile

To use and create a new interaction profile instead of the ones included in the Snapdragon Spaces plug-in, you may create a new class. This class can inherit from IModuleInterface and IOpenXRExtensionPlugin interfaces and implement the functions StartupModule, ShutdownModule, GetDisplayName and GetInteractionProfile. In StartupModule the necessary keys must be created and in GetInteractionProfile the intended interaction profile must be configured, you can see how it is done in our class FSpacesInputExtension. Make sure that this new module is loaded in the PostConfigInit loading phase. Finally, you can create the desired action and axis mappings with the keys created in the previous class and use the inputs in the project.