Official website introduction : https://docs.microsoft.com/zh-cn/windows/mixed-reality/mrtk-unity/?view=mrtkunity-2022-05
Author Unity version: 2020.3.18
Historical development version: 2019 version Unity
1 , Environment configuration
Unity:
Recommended environment configuration post: https://blog.csdn.net/shedipai0528/article/details/123377096
Open the corresponding version of Unity, select File/Build Settings, select UWP and click Switch Platform
Mixed Reality Feature Tool:
Download address: https://www.microsoft.com/en-us/download/details.aspx?id=102778
After the download is complete, unzip it and open the folder Loding with the suffix exe...
Follow the instructions on the official website to import the package
Official website address:
https ://docs.microsoft.com/en-us/windows/mixed-reality/develop/unity/welcome-to-mr-feature-tool
specific author I imported four packages:
Mixed Reality OpenXR Plugin (required) Mixed Reality OpenXR plug-in
Mixed Reality Toolkit Foundation (required) Basic package
Mixed Reality Toolkit Tools (personally recommended) contains some practical tools: build window, optimize window, UI toolbox
Mixed Reality Toolkit Examples ( Personal recommendation) Sample package, must be used by
novices 3. After Unity imports the package in your project , select Yes to restart the Unity editor to enable the new plugin 4. The MRTK project configurator should appear. If not, open it manually by selecting Mixed Reality > Toolkit > Utilities > Configure Project for MRTK 5. Select Unity OpenXR Plugin to enable XR Plugin Management and add its required packages to your project 6. Import XR Plugin Management After the required Unity packages are selected, in the MRTK Project Configurator select Show XR Plugin Management Settings **7. The project settings open.
**Under XR Plug-in Management, make sure Universal Windows Platform settings (Windows logo tab) is active, then make sure the Initialize XR on Startup, Open XR, and Microsoft HoloLens feature groups are all enabled (checkboxes checked) Note
: Here comes the big pit. There is no exclamation mark after Open XR in the official description. If so, please refer to the next step
HoloLens2 Road - Unity2020.3+MRTK2.7 Configuration_DavidWang-CSDN Blog
https://blog.csdn.net/yolon3000 /article/details/121776416
8. Click the yellow triangle warning sign to pop up a panel requesting to fix the problem. Click "Fix All" to fix it.
9. After the fix is completed, the following 3 Fixes will be fixed, but there will be one Edit left. Click the "Edit" button and close the pop-up panel. Add the two configuration files "Microsoft Hand Interaction Profile" and "Microsoft Motion Controller Profiler" in the newly opened interface.
Note: If eye movement is required, then add the Eye Gaze Interaction Profile configuration file (I don’t know why, if you don’t add eye movement, you only need to add it)
10. On the update message of MRTK Project Configurator, select Apply Settings. To verify the OpenXR configuration, select OpenXR under XR Plug-in Management and verify that the following items are selected:
11. In the MRTK Project Configurator window, select Next, then Apply. (You can manually open the configurator from Mixed Reality > Toolkit > Utilities > Configure Project for MRTK)
12. 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, then in the Package name field, enter an appropriate name
"Package name" is a unique identifier for the application. You should change this identifier before deploying your application to avoid overwriting previously installed applications.
"Product Name" is the name displayed in the HoloLens start menu. To make applications easier to locate during development, put an underscore before the name to sort it to the top of any list.
13. Update project settings
In the Unity menu, select Mixed Reality->Project->Apply recommended project settings for HoloLens2 to update the current development environment.
14. Create a 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 create to create a new scene
3. In the Unity menu, select Mixed Reality > Toolkit > Add to Scene and Configure… to add MRTK to the current scene
4. With the MixedRealityToolkit object still selected in the Hierarchy window, in the Inspector window, verify that the MixedRealityToolkit profile is set to DefaultHoloLens2ConfigurationProfile
5. In the Unity menu, select File > Save As… Open the Save Scene window
6. Save the scene in the project under Asset > Scenes
15. Import the sample scene
1. If you imported the Mixed Reality Toolkit Examples package in Section 3.3, click Mixed Reality->Toolkit->Utilities->Import directly Examples from Package (UPM), open the Package Manager window
2. In the list on the right side of the panel, click the "Import" button next to the sample scene name to import
3. After importing, it will be available under the "Assets->Samples" folder find them. The HandInteractionExamples scene is a good place to start experimenting with MRTK's spatial interaction and UI building blocks.
VS:
1.
2.