Exercise - Configure Unity for Windows Mixed Reality
Before you can get started creating an immersive experience for Windows Mixed Reality, you must configure your Unity Project for Windows Mixed Reality development. Unity offers some behaviors specific to mixed reality that can be modified through project settings. Here you'll create a new Unity project and configure it for Windows Mixed Reality development.
Create a new Unity project
Launch the Unity Hub, select the Projects tab, and click the down arrow next to the New button.
Select the Unity version specified in the module Prerequisites.
In the Create a new project window:
- Ensure Templates is set to 3D
- Enter a suitable Project Name, for example, MRTK Tutorials
- Choose a suitable Location to store your project, for example, D:\MixedRealityLearning
- Click the Create button to create and launch your new Unity project
When working on Windows, there is a MAX_PATH limit of 255 characters. Unity is affected by these limits and may fail to compile if any file path is longer than 255 characters. Therefore, it is strongly recommended to store your Unity project as close to the root of the drive as possible.
Configure Unity Project for Windows Mixed Reality
Switch Build Platform
In the Unity menu, select File > Build Settings... to open the Build Settings window.
In the Build Settings window, select Universal Windows Platform and click the Switch Platform button. Unity will begin the process to switch the platform.
Close the Build Settings window once Unity has finished switching the platform.
Enable Virtual Reality
In the Unity menu, select Edit > Project Settings... to open the Project Settings window.
In the Project Settings window, select Player > XR Settings to expand the XR Settings.
In the XR Settings, check the Virtual Reality Supported checkbox to enable virtual reality.
Next, click the + icon and select Windows Mixed Reality to add the Windows Mixed Reality SDK. Unity will begin the process to add the SDK.
After the SDK is added, optimize the XR Settings as follows:
- Set Windows Mixed Reality Depth Format to 16-bit depth
- Check the Windows Mixed Reality Enable Depth Sharing checkbox
- Set Stereo Rendering Mode to Single Pass Instanced.