Unity MR Part 1: Setting up Unity
Tags: unity3d, mixedreality, tutorial, beginners
Published: 2024-01-10 10:11:57

👀 Stumbled here on accident? Start with the [introduction](https://dev.to/taikonauten/part-0-introduction-56fl)!

📚 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](https://github.com/taikonauten/unity-mr-article-series/tree/main/01_SettingUpUnity)

---

## 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](https://unity.com/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](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@6.0/manual/project-setup/edit-your-project-manifest.html).

![Install the Unity Editor and choosing Android build support
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j4he424gwsljzkj0bxiu.png)
<figcaption>Install the Unity Editor and choosing Android build support</figcaption>
---

![Installs tab after successful installation of the Unity Editor
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wgnebrv7td5eprkerf2f.png)
<figcaption>Installs tab after successful installation of the Unity Editor</figcaption>
---

## 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](https://unity.com/srp/universal-render-pipeline).

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8l00j5xnzittoom7cjp0.png)
<figcaption>Creating an new project using the 3D (URP) template</figcaption>
---

## 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",
    "com.unity.xr.interaction.toolkit": "2.5.2",
    "com.unity.xr.meta-openxr": "1.0.1",
    "com.unity.xr.openxr": "1.9.1"
```

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/43dpl38xhxq0vqveudxl.png)
---

Save the file and return to the Unity Editor. If you get the following warning choose ‘yes’.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9zlwglcurfz1su0ztiem.png)
---

## 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/314vvu091vm40m7xzc1u.png)
<figcaption>Enabling OpenXR in XR Plug-in Management for Desktop</figcaption>
---

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gqw2bscmgr1ts5gdm8sm.png)
<figcaption>Enabling OpenXR in XR Plug-in Management for Android</figcaption>
---

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](https://docs.unity3d.com/Packages/com.unity.xr.openxr@1.9/manual/features/metaquesttouchprocontrollerprofile.html) 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d34tjnjnk2whhx6oyr5h.png)
<figcaption>Adding the Meta Quest Touch Pro Controller Profile for Desktop</figcaption>
---

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kuah7nlzsm857v0z9f10.png)
<figcaption>Adding the Meta Quest Touch Pro Controller Profile for Android</figcaption>
---

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yt5ptlo4x66eh93bsigz.png)
<figcaption>Issues Desktop tab</figcaption>
---

![Issues Android tab](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c3iwobiwiuwnhi9gn7e2.png)
<figcaption>Issues Android tab</figcaption>
---

![Remaining issues after Fix All](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1hnn53wz0hd9hwk9ii2w.png)
<figcaption>Remaining issues after Fix All</figcaption>
---

## 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.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/noo9uxu0sp9dx6p11bvn.png)
---

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.