How to Setup and Program Virtual Reality Apps for Windows MR Headsets
If you really want to blur the boundaries between reality and simulation, you need Windows MR. Until the release of the Magic Leap, the Hololens dominates the mixed reality space as the best option for augmenting the world around you with immersive content.
But Windows Mixed Reality is also the platform that powers virtual reality headsets from Asus, Lenovo, Acer, Dell and HP. So whether you’re building a fully mixed experience for the Hololens or a VR experience for another Windows MR headset, this guide will get you ready to build.
Before You Get Started
Are you looking to develop for a different device?
- GearVR (How to Make VR Apps for Samsung GearVR)
- Oculus (How to Make VR Apps for Oculus)
- Daydream (How to Make VR Apps for Google Daydream)
- Vive (How to Make VR Apps for HTC Vive)
To learn how to make AR apps, check out How to Make Augmented Reality Apps with Vuforia.
Step 1: Get the Tools
In your internet browser, head over to the MR Toolkit releases section of Microsoft’s Git-Hub. This is the page for the most recent release of MixedRealityToolkit-Unity, a Unity-specific plugin for building Windows MR applications. To download the release, click on the first .unitypackage file that follows the naming convention “HoloToolkit-Unity-YEAR.#.#.#.unitypackage.” You only need this file, not the Examples or PreviewFeatures options.
After the file has downloaded, find it in your computer’s file manager. Open the main window of your Unity project as well, and click and drag the downloaded package into your Assets folder in the Project tab in Unity. A prompt will appear asking if you’d like to import the whole package. We’ll need everything in that folder, so choose the option to import all of it.
Step 2: Adjust the Settings
Now that you’ve imported the Mixed Reality Toolkit, it should appear as a new dropdown option at the top of your Unity editor. Click on it, then select Configure and click “Apply Mixed Reality Project Settings.” A prompt will appear with a checklist of options. Take a look at the list and make sure everything is selected except “Enable Sharing Services.” Once you apply the settings, head back into the list and double check that your selections were saved. A quick head’s up that a reported bug will occasionally interrupt this saving process, so you may need to make the selections and apply them more than once.
Next, head into the File menu at the top of the main project window and click on “Build Settings.” In the “Universal Windows Platform” section, make sure the Unity C# Projects debugging option is not selected.
Step 3: Set Up the Camera
We have several cameras interfering with each other, so let’s get rid of the things we don’t need. In your Hierarchy tab, right-click on the Main Camera and delete it. Then head over to your Project tab. In the search bar on the top right, type “Camera” and look for the “MixedRealityCameraParent” prefab. When you find it, click and drag it into your scene. Do a search for “InputManager” as well, also adding it to your scene, and then do the same thing for “DefaultCursor.”
That’s it! Unity is now ready for you to create your Windows MR application.
- Go to the Microsoft’s Git-Hub and click on releases, Find the most recent release of the MixedRealityToolkit-Unity. Click on the unitypackage file to download it (Not the examples file, It may be named HoloToolkit-Unity-Year.version.unitypackage)
- Find this package in your download folder and click and drag it into your asset folder in your project tab in Unity. A prompt will appear click the button on the bottom right to import all of it.
- A new drop down option should appear in the top of your Unity editor named “Mixed Reality Toolkit”. Click on it and select Configure > Apply Mixed Reality Project Settings. A prompt appears with a checklist, make sure all are checked except enable sharing services. (Double check the checklist after you apply, there is a bug that may not apply them the first time).
- Go to File > Build Settings and make sure Unity C# projects is checked off under Debugging.
- Delete the MainCamera from your scene, go to your projects tab and use the search bar on the top right. Type in Camera and look for “MixedRealityCameraParent”, Click and drag that prefab into your scene. Repeat this for InputManager, DefaultCursor.
- Save the scene!