DEV Community

Cover image for Unity MR Part 1: Setting up Unity
tststs for Taikonauten

Posted on • Edited on • Originally published at Medium

Unity MR Part 1: Setting up Unity

๐Ÿ‘€ Stumbled here on accident? Start with the introduction!

๐Ÿ“š This article provides a comprehensive guide on setting up Unity for MR development with the Meta Quest 3. It covers the installation of Unity, creation of a new 3D project, installation of necessary packages, and configuration of the XR-Plug-in, equipping you with the foundational steps needed to begin developing MR applications on the Meta Quest 3 platform using Unity.


โ„น๏ธ If you find yourself facing any difficulties, remember that you can always refer to or download the code from our accompanying GitHub repository


About Unity

Unity offers a robust and flexible development platform for MR applications, providing extensive support for immersive experiences with its advanced rendering capabilities, comprehensive asset library, and wide-ranging compatibility with various MR hardware.


Install Unity Editor via Unity Hub

Install Unity Hub, create an account and get Unity 2023.2.3f1 with Android Build Support.

โ„น๏ธ If you're wondering why Android build support is necessary, it's because the Meta Quest 3 operates on a modified version of Android 12.

We are using the latest 2023.2.3f1 build to have access to ARFoundation 6.0. You can read more about the topic here: Access AR Foundation 6.0 in Unity 2023.2 | AR Foundation | 6.0.0-pre.5.

Install the Unity Editor and choosing Android build support<br>

Install the Unity Editor and choosing Android build support

Installs tab after successful installation of the Unity Editor<br>

Installs tab after successful installation of the Unity Editor

Create a new Unity 3D (URP) project

This series of articles will utilize the Universal Render Pipeline (URP) instead of the default render pipeline.

โ„น๏ธ If you're unfamiliar with URP, or the Universal Render Pipeline in Unity, you can gain a thorough overview by following this link: Universal Render Pipeline (URP) | Unity.

Create a new project 3D (URP) within the Projects tab. Make sure you select the Editor Version 2023.2.3f1.

Creating an new project using the 3D (URP) template

Creating an new project using the 3D (URP) template

Install required packages

Open your projects manifest.json file and append the following required packages.

โ„น๏ธ To find the manifest.json file in Unity, you need to navigate to your Unity project's directory on your computer. Inside the project folder, look for the Packages folder. The manifest.json file will be located within this folder. This file is used to manage project dependencies and Unity package versions, making it a critical part of Unity project configuration.


"com.unity.xr.arfoundation": "6.0.0-pre.4",
Enter fullscreen mode Exit fullscreen mode

ย  ย  "com.unity.xr.interaction.toolkit": "2.5.2",
ย  ย  "com.unity.xr.meta-openxr": "1.0.1",
ย  ย  "com.unity.xr.openxr": "1.9.1"

Enter fullscreen mode Exit fullscreen mode





Save the file and return to the Unity Editor. If you get the following warning choose โ€˜yesโ€™.

Configure the XR-Plug-in

Find the XR Plug-in Management settings via Edit โ†’ Project Settings. Make sure to edit both Windows, Mac, Linux (Desktop) settings and Android settings.

First configure Desktop by enabling OpenXR as seen in the next screenshot.

Enabling OpenXR in XR Plug-in Management for Desktop

Enabling OpenXR in XR Plug-in Management for Desktop

Then, switch to Android and also enable OpenXR and the Meta Quest feature group as seen n the next screenshot.

Enabling OpenXR in XR Plug-in Management for Android

Enabling OpenXR in XR Plug-in Management for Android

Add the Meta Quest Touch Pro Controller Profile to the list of Enabled Interaction Profiles for Desktop and Android build. For details on the available controls, refer to the Meta Quest Pro Touch Controller Profile | OpenXR Plugin | 1.9.1 documentation.

For desktop we only need to add the controller profile as seen in the next screenshot.

Adding the Meta Quest Touch Pro Controller Profile for Desktop

Adding the Meta Quest Touch Pro Controller Profile for Desktop

Switch to the Android tab, add the controller profile and enable all features in the Meta Quest feature group. The features are most likely already enabled.

Adding the Meta Quest Touch Pro Controller Profile for Android

Adding the Meta Quest Touch Pro Controller Profile for Android

At present, you might come across one or more issues during the Project Validation process. To address these, use the Fix All option. However, be aware that Fix All won't resolve all warnings in your project, as depicted in the forthcoming screenshots. This situation is acceptable, as we will be addressing and resolving these warnings manually throughout the course of our article series.

Issues Desktop tab

Issues Desktop tab

Issues Android tab

Issues Android tab

Remaining issues after Fix All

Remaining issues after Fix All

Using the Meta Quest Link Cable

Meta Quest Link provides a simplified method for skipping the Android build process in Unity. However, it lacks critical features such as Plane Detection and Passthrough, rendering it ineffective for real-world mixed reality application testing. Presently, there is no indication as to whether or when these capabilities might be implemented.

Alternatively, you can switch to Android within the Build Settings in Unity. Follow these steps:

  1. Access the Build Settings by navigating to File โ†’ Build Settings.
  2. Make sure to add the SampleScene via Add Open Scene to Scenes in Build. Normally the SampleScene is already included so you can properly skip this step.
  3. Select Android as a Platform and press the Switch platform button at the bottom right.

With this setup, we now have two methods to launch apps on the Meta Quest 3: without passthrough directly from the Unity editor, and with passthrough using the Build and Run feature. The build and run process deploys the app as an Android app to your Meta Quest 3, but it takes significantly longer than simply pressing the play button in Unity. Weโ€™ll start by using the the first method and later switch to Build and Run.


Next article

In our next article, we will introduce a key component in MR development: the Session Component. This feature plays a crucial role in managing the MR session, effectively serving as the backbone of any mixed reality application.

Top comments (0)