Exercise - Import and configure resources
The Mixed Reality Toolkit provides a set of components and features which could be used to accelerate your Windows Mixed Reality app development. To use the toolkit in your mixed reality project, you must import the package and configure the resources added to the project. Here you'll import and configure resources to add the Mixed Reality Toolkit to your project.
Import the MRTK Unity foundation package
To Import Mixed Reality Toolkit into the Unity Project you'll have to use Mixed Reality Feature Tool, which allows developers to discover, update, and add Mixed Reality feature packages into Unity projects. You can search packages by name or category, see their dependencies, and even view proposed changes to your projects manifest file before importing.
Download the latest version of the Mixed Reality Feature Tool from the Microsoft Download Center , When the download is complete, unzip the file and save it to your desktop.
Before you can run the Mixed Reality Feature Tool please install .NET 5.0 runtime
Open the executable file MixedRealityFeatureTool from the downloaded folder to launch the Mixed Reality Feature Tool.
Once MixedRealityFeatureTool is opened, select Start to launch the Mixed Reality Feature Tool.
Select the ellipsis icon next to Project path and browse to your project folder; for example, D:\MixedRealityLearning\MRTK Tutorials, and then select Open.
When browsing for the Unity project folder, by default, the dialog contains a backslash '_' for the file name. You must provide a value in this field in order to select the folder.
The Mixed Reality Feature Tool performs validation to ensure that it has been directed to a Unity project folder. The folder must contain Assets, Packages, and Project Settings folders.
In the Mixed Reality Feature Tool, select Discover Features. Features are grouped by category.
Select Mixed Reality Toolkit to find packages relating to the Mixed Reality Toolkit, and then select Platform Support to find packages relating to platforms.
Ensure Mixed Reality Toolkit Foundation is checked, and then select MRTK 2.7.0 for that field.
Ensure Mixed Reality OpenXR Plugin is checked, and then select most recent version available.
Select Get features. A dialog prompts you to validate your choices.
Select Validate to validate the selected package. The system should return No validation issues were detected.
Select OK, and then select Import.
Select Approve to add the Mixed Reality Toolkit to your project.
Configure the Unity project
After Unity has imported the package, select Yes to restart the Unity editor to enable to backends for new plugin.
The MRTK Project Configurator should appear. If it doesn't, manually open it by selecting Mixed Reality > Toolkit > Utilities > Configure Project for MRTK:
Select Unity OpenXR Plugin to enable XR Plugin Management and add its required packages to your project.
When the required Unity packages for XR Plugin Management have been imported, select Show XR Plug-In Management Settings in MRTK project Configurator.
Project Settings opens. Under XR Plug-in Management, ensure that Universal Windows Platform settings (Windows logo tab) is active, and then ensure Initialize XR on Startup, Open XR, and Microsoft HoloLens feature set are all enabled (checkboxes are checked).
On the MRTK Project Configurator update message, select Apply Settings.
To validate OpenXR configuration, under XR Plug-in Management select OpenXR and verify the following items are checked:
- Depth Submission Mode: Depth 16 Bit
- Interaction Profiles: Microsoft Hand Interaction Profile
Reducing the Depth Format to 16-bit is optional, but it may improve graphics performance in your project. To learn more about this topic, refer to Depth buffer sharing (HoloLens).
In the MRTK Project Configurator window, select Next, and then select Apply. (You can manually open the configurator from Mixed Reality > Toolkit > Utilities > Configure Project for MRTK)
Unity must restart in order for the configuration to take effect. When prompted, select Apply to restart the Unity editor.
When Unity restarts, from the Unity menu, open MRTK Project Configurator, and then select Next and Done to complete the configuration for OpenXR.
Configure project settings for OpenXR
In the Unity menu, select Edit > Project Settings... to open Project Settings.
In Project Settings, select Player > Publishing Settings, and then in the Package name field, enter a suitable name; for example, MRTKTutorials-GettingStarted:
'Package name' is the unique identifier for the app. You should change this identifier before deploying the app to avoid overwriting previously installed apps.
'Product Name' is the name displayed in the HoloLens Start menu. To make the app easier to locate during development, add an underscore in front of the name to sort it to the top of any list.
Create the scene and configure MRTK
In the Unity menu, select File > New Scene:
In the New Scene window select Basic (Built-in) and click on create to create a new scene:
In the Unity menu, select Mixed Reality > Toolkit > Add to Scene and Configure... to add the MRTK to your current scene:
With the MixedRealityToolkit object still selected in the Hierarchy window, in the Inspector window, verify that the MixedRealityToolkit configuration profile is set to DefaultMixedRealityToolkitConfigurationProfile:
In the Unity menu, select File > Save As... to open the Save Scene window:
Save the scene in you project under Asset > Scenes.