Updating MRTK Mixed Reality Project to OpenXR+Unity 2020: Periodic Table of the Elements for HoloLens 2

Example of updating existing MRTK 2.x + Unity 2019 project to the latest Unity 2020 + OpenXR pipeline

Periodic Table of the Elements is a sample app that demonstrates the use of MRTK’s UX building blocks. Originally designed for HoloLens 1st generation, it has been updated to support HoloLens 2’s hand-tracking and eye-tracking interactions. You can find HoloLens 2 porting story from this article:

MRTK (Mixed Reality Toolkit)

MRTK is an open-source project driven by Microsoft which provides crucial building blocks for Mixed Reality experiences such as input system, spatial awareness, spatial interactions, and UI.

To learn more about MRTK, please visit http://aka.ms/mrtkdocs

MRTK’s UX Building Blocks

OpenXR

OpenXR is an open royalty-free API standard from Khronos, providing engines with native access to a range of devices across the mixed reality spectrum. With OpenXR, you can build experiences that target multiple platforms.

Before & After OpenXR

MRTK 2.7, Unity 2020, and OpenXR

From the 2.7 release, MRTK officially supports OpenXR. Unity 2020.2 or higher supports OpenXR. However, Unity 2020.3.8 or higher is recommended for the latest bug fixes and improvements.

Upgrading MRTK, adding OpenXR plugin using Mixed Reality Feature Tool

Before upgrading MRTK, please make sure to backup any scripts that you directly modified in MRTK. In general, if you need any modification or extension of existing MRTK’s functionality, it is recommended put your custom scripts in a separate folder to make your project easily upgradable to any future release of MRTK. For example, Periodic Table project has custom or modified scripts under MRDL_PeriodicTable folder. This allows us to easily upgrade MRTK by simply deleting/updating MRTK folder.

If your project is already using MR Feature Tool

If you are already using MR Feature Tool for your project, you can skip the step below.

If your project is not using MR Feature Tool

If your project uses MRTK as a source code or if you had imported MRTK .unitypackages manually by using Import > Custom Assets, simply delete the existing MRTK folder from your project. You can do this either from Unity editor while the project is opened, or you can do it in the File Explorer. You can expect a lot of error messages when you delete MRTK folder while the project is opened.

Mixed Reality Feature Tool is a new app that allows you to easily discover, download, and import many Mixed Reality feature packages into Unity projects.

Launch MR Feature Tool and select your Unity project folder.

On the Discover features page, under the Mixed Reality Toolkit section, select the MRTK packages that your project needs. Select Mixed Reality OpenXR Plugin under the Platform Support section.

For the Periodic Table of the Elements project, these packages have been selected.

  • Mixed Reality Toolkit Foundation
  • Mixed Reality Toolkit Standard Assets
  • Mixed Reality Toolkit Tools
  • Mixed Reality OpenXR Plugin

Go back to the Unity project if your project is already opened, or run Unity and open the project.

Configuring Unity Project

It will take some time for Unity to import and process MRTK packages. Once it is done, it will display MRTK Project Configurator which will help you configure options. Click Unity OpenXR plugin (recommended) button.

NOTE: Unity might restart several times to apply required changes

On the next page, click Show XR Plug-in Management Settings button. This will open Unity’s Project Settings.

In the Project Settings, Select XR Plug-in Management > Windows tab and check OpenXR using the checkbox.

Once the processing is done, it will show an updated page in the MRTK Configurator window. Click Apply Settings. This will automatically update configurations needed in OpenXR.

Options automatically configured for OpenXR & HoloLens 2

Finally, click Apply to apply recommended MRTK settings.

When the project configurations are done, select the MixedRealityToolkit object in your scene and verify any missing profiles. For the Periodic Table project, the Experience Settings’ profile was not assigned because this feature didn’t exist in the previous MRTK release.

Verifying your project in Unity with MRTK Input Simulation

Click Play button to run and test your scene with MRTK’s input simulation.

Verifying your project on the devices

Building and deploying the project to the HoloLens device follows the same steps for OpenXR.

The project running on HoloLens 2 with OpenXR + Unity 2020 + MRTK 2.7.2

That’s it! Without any modification, the project runs well on HoloLens 2 device with Unity 2020 + OpenXR + MRTK 2.7.x

You can download the project from GitHub. Currently, upgrade project is under MRTKv272_Unity2020_OpenXR branch.

Ready to create amazing experiences for mixed reality? Visit the pages below and learn more about MRTK and mixed reality.

Resources

Microsoft MR Dev Days 2020 Session Video: MRTK’s UX Building Blocks

Read my other stories

Designing Type In Space for HoloLens 2

Designer & Creative Technologist. UX Designer @Microsoft HoloLens. Creator of http://typeinsight.org Opinions are my own. http://dongyoonpark.com