Exploring Unity 6's Mixed Reality template

Context

As I continue to have a goal of learning more about the world of XR development, I’m happy to see that there are many free resources available that help you to dive into this field. In this article, I’ll cover how you can get started using unity's mixed reality template, and even how to build it to your device, which in my case I’ll be using my Meta Quest 3.

From their documentation:

Unity’s Mixed Reality (MR) Template provides a starting point for mixed reality development. The template configures project settings, pre-installs the right packages, and includes various pre-configured Example Assets to demonstrate how to set up a project that is ready for MR.

⚠ Note: To follow along, you’ll need one of the following XR devices: ⚠

Acquiring the MR template

For this project, I'm going to be using Unity version 6.1.2. At the time of me writing this article, it's one of unity's latest stable releases.

One thing to note is that I will be using Android development tools for the rest of the article, so make sure to include the Android build support when you're installing this version of Unity:

Now let's go ahead and create a new project, to get started simply click on the new project button shown below:

Make sure that you are creating a new project with the correct Unity editor version, as shown on top of the image below. On the left hand side of the unity hub, make sure to select the All Templates category, and click on the Mixed Reality (MR) template:

YES! There’s also a multiplayer template!

One quick note about creating your new project is that you will not need to connect this to the unity cloud, since we won't be using any online multiplayer features, so feel free to leaved it disabled:

Perhaps I'll cover multiplayer in a future article.

To continue, make sure to give it a name and the location, and then simply create the project by clicking on the Create Project button shown below:

This will take a little while, since you're going to be creating a brand new project, but after the process is done, the unity editor should look like this:

And if you don't see this scene open, simply search for the sample scene on the scenes folder located under the main assets folder:

[Optional] - Testing in play mode

One note about testing this template is that when you play the template in the editor’s regular play mode, you won’t have any environment data from the real world available, so it’s not ideal or particularly fun:

But in case you’d like to know how to add a virtual XR device to your project, here we go! First, let’s go to the project settings:

In Project settings menu, go into the XR Plug-in Management section, and go into the XR Interaction Toolkit sub-section:

Then enable the option to use XRI simulator in scenes:

You’ll get this prompt, which let’s you know of assets that will be added to your project:

And lastly, the XRI subsection will update to have the XR device simulator enabled:

Add your first interactable object

This is just a small step to show you how you can play around with the device simulator. Let's go ahead and add one of the available interactable prefabs. On the assets search bar type TotemFloatingTorus - Occlusion , and add the prefab to the scene:

It’ll look like this on your scene:

And to make it easier to find, increase the scale of the object to 1.0 on all axis:

Play the scene again, and move around (you can use WASD controls) until you find the interactable object. Press and hold the G key on the keyboard near the rings to grab them. Move around and you’ll see that you can move around while grabbing the object.

Building to your MR device

In order to try the project using your device, you’ll need to build the project, and transfer it to your device.

Setting up your device

Although today it is much easier to build your own applications for XR devices, you still have to go through a setup process, and depending on the device you're using, it can vary in difficulty or length in process. I'm using a Meta Quest 3 device, and I followed the steps listed in their device setup page.

Building for Android

Thankfully, this process is not a long one, since the template is setup to virtually work out the box. We’ll 1st need to change the build profiles to build for Android:

BTW, build profiles are a very cool new feature in unity 6, which was requested by many users, and it's awesome that they are available!

A build profile is a set of configuration settings you can use to build your application on a particular platform. Click on the Android platform, and press click the Switch Platform button on the bottom-right corner:

From Unity’s documentation: Use the Build Profiles window to create multiple build profiles for each platform you work on, saving different configurations for release and development builds

This change will take a little while. Unity will start to switch the build mode to the Android platform, and it'll recompile some scripts. Once the process is done, it should look like this:

Assuming your XR device is connected to your computer, and that you set up your XR device like I mentioned before, it should be listed under which device to run the application to, like so:

If it doesn't appear, make sure to go through the setup developer mode process again to make sure that your device is ready to install custom applications. But if all is good to go, click on the Build and Run button:

When you build for the first time, you'll be asked to specify where you would like to store the created build. It's good practice to create a dedicated folder to store builds:

Then click on the Save button:

This begins the build process which will take a few minutes:

This 1st build process is long, but the next ones take much less time

[Note] - Possible error

A quick note is that when I first tried to build this, I ran into this error, which may not happen to you, but I wanted to share how I quickly fixed it.

The error here is that the project for some reason was not pointing to the right tools to build the Android application. To quickly fix this, first go to Unity preferences:

Make sure that the Gradle library used is the one installed with your Unity editor version. It's supposed to be checked, and it wasn't for me for some reason.

After this step and re-trying, I was able to build and run the application on my device.

1st playthrough

You’ll need to setup your space environment, thankfully the Quest 3 has a very interactive and easy to follow process to set this up. But after you setup your space, you’ll be able to place items by just tapping the surfaces.

If you try out the sitting cylinder, you’ll see that the objects with physics react to the colliders on the detected planes from the real-world geometry:

Lessons learned

  • It is incredibly easier today to build for Android in general, and to XR devices!

  • It's definitely a lot to explore here from a design point of view, because now you have to think about the physical space where you'll be playing your game, and how your virtual objects will interact with it.

Please let me know what you think!

  • Have you tried this template or any of the other Unity XR templates?

  • Are you working on any XR projects at the moment?

  • If you're an XR game player, what game are you playing right now?

🎉🎉🎉 Happy building! 🎉🎉🎉

0
Subscribe to my newsletter

Read articles from Esteban Maldonado directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Esteban Maldonado
Esteban Maldonado

👋🏾 Hello! 👋🏾 My name is Esteban and I love video games and learning about making games. I'm sharing here my progress as I build up my skills and learn new technologies.