Exercise - Import and configure resources

Completed

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.

Note

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.

Screenshot of Opening MixedRealityFeatureTool.

  1. Once MixedRealityFeatureTool is opened, select Start to launch the Mixed Reality Feature Tool.

    Screenshot of MixedRealityFeatureTool.

  2. Select the ellipsis icon next to Project path and browse to your project folder; for example, D:\MixedRealityLearning\MRTK Tutorials, and then select Open.

    Note

    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.

    Screenshot of Adding Unity Path for MixedRealityFeatureTool.

  3. In the Mixed Reality Feature Tool, select Discover Features. Features are grouped by category.

  4. Select Mixed Reality Toolkit to find packages relating to the Mixed Reality Toolkit, and then select Platform Support to find packages relating to platforms.

    Screenshot of MixedRealityFeatureTool Discover Features.

  5. Ensure Mixed Reality Toolkit Foundation is checked, and then select MRTK 2.7.0 for that field.

  6. Ensure Mixed Reality OpenXR Plugin is checked, and then select most recent version available.

  7. Select Get features. A dialog prompts you to validate your choices.

    Screenshot of MixedRealityFeatureTool Open MixedReality.

  8. Select Validate to validate the selected package. The system should return No validation issues were detected.

  9. Select OK, and then select Import.

    Screenshot of MixedRealityFeatureTool Select required package.

  10. Select Approve to add the Mixed Reality Toolkit to your project.

    Screenshot of MixedRealityFeatureTool Validate package.

Configure the Unity project

  1. After Unity has imported the package, select Yes to restart the Unity editor to enable to backends for new plugin.

    Screenshot of Unity Restart Option.

  2. The MRTK Project Configurator should appear. If it doesn't, manually open it by selecting Mixed Reality > Toolkit > Utilities > Configure Project for MRTK:

    Screenshot of Open MRTK project configurator window.

  3. Select Unity OpenXR Plugin to enable XR Plugin Management and add its required packages to your project.

    Screenshot of Add Unity OpenXR Plugin.

  4. When the required Unity packages for XR Plugin Management have been imported, select Show XR Plug-In Management Settings in MRTK project Configurator.

    Screenshot of Show XR Plug-In Management Settings.

  5. 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).

    Screenshot of Project Settings Window 3.

  6. On the MRTK Project Configurator update message, select Apply Settings.

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

    Screenshot of Project Settings Window 4.

    Tip

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

  8. 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)

    Screenshot of MRTK Project Configurator.

  9. Unity must restart in order for the configuration to take effect. When prompted, select Apply to restart the Unity editor.

    Screenshot of MRTK Project Configurator 2.

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

  1. In the Unity menu, select Edit > Project Settings... to open Project Settings.

  2. In Project Settings, select Player > Publishing Settings, and then in the Package name field, enter a suitable name; for example, MRTKTutorials-GettingStarted:

    Screenshot of Unity Publishing Settings with package name configured.

    Note

    'Package name' is the unique identifier for the app. You should change this identifier before deploying the app to avoid overwriting previously installed apps.

    Tip

    '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

  1. In the Unity menu, select File > New Scene:

  2. In the New Scene window select Basic (Built-in) and click on create to create a new scene:

  3. In the Unity menu, select Mixed Reality > Toolkit > Add to Scene and Configure... to add the MRTK to your current scene:

  4. With the MixedRealityToolkit object still selected in the Hierarchy window, in the Inspector window, verify that the MixedRealityToolkit configuration profile is set to DefaultMixedRealityToolkitConfigurationProfile:

  5. In the Unity menu, select File > Save As... to open the Save Scene window:

  6. Save the scene in you project under Asset > Scenes.