Introduction
This is a guide to get started with HoloLens development running Windows 10 inside Parallels on MacOS.
I used this page to get a list of the required tools, but getting everything running as intended ended up taking me a couple of days, so I guess sharing the pitfalls might help someone else.
https://developer.microsoft.com/en-us/windows/holographic/install_the_tools
HoloLens development requires a Windows environment. I set up a virtual machine using Parallels, but a bootcamp partition can be used as well. For using the same setup as me, the following software is required:
- Parallels
- Visual Studio 2015 Update 3
- Windows 10 SDK
- Unity HoloLens Technical Preview edition
- HoloLens Emulator (if you don’t have access to an actual HoloLens)
- The first thing to do is install Parallels. I just started with the 14 days free trial.
Parallels lets you use the Windows 10 Development without getting a Windows 10 image from elsewhere.
Guide
Next up, install Visual Studio inside the virtual machine. I did a custom install just to make sure that the required two tools was being installed:
- Tools (1.4)
- Windows 10 SDK (10.0.10586)
https://developer.microsoft.com/en-us/windows/downloads
Next up install Unity HoloLens Technical Preview edition inside the wm. There are a couple og different beta builds available of this version of Unity, I ended up trying several because of different problems, but I ended up getting 5.4.0f3-HTP to work. Make sure that Windows Store support is enabled during the installation.
If you don’t have access to an actual HoloLens, get the emulator here:
https://unity3d.com/partners/windows/hololens
This all went well and easy for me, the real problems started when attempting to build and deploy an actual HoloLens app. There are some great tutorials for setting up pet projects here:
https://developer.microsoft.com/en-us/windows/holographic/academy
Deployment
The deployment process should work something like this:
- Create some holographic content in Unity using the 3D editor and some scripting
- Set the Unity build settings to output a Windows Store project
- Make Unity build the project
- Open Unitys output with Visual Studio
- Make Visual Studio compile, build and deploy your app
- See the app running on an emulator or actual device
Step 1 should be done with the help of Windows Holographic Academy that is linked above.
Step 2 requires changing the follow settings in Unity:
Go to File -> Build Settings and change the platform to Windows Store. If the Switch Platform button is grayed out, the Windows Store platform support was not installed and the easiest way to fix this is to simply uninstall Unity and install it again, making sure that the Windows Store support is enabled during installation. Change SDK to Windows 10, change UWP Build Type to D3D and enable Unity C# Projects. Build the project and look for errors in the console.
Now I had a lot of problems at this point because Parallels supports folder sharing between host OS and virtual OS and I had chosen to store my Unity project in //Documents/HoloLens. The Windows Documents folder is shared between the host and virtual OS by default in Paralles, meaning that file paths in the documents folder starts with the double slash instead of a drive letter, indicating a network path instead of a path on the local machines hard disk. This gave a lot of unpredictable errors and the resulting Visual Studio Project ended up getting compile errors. Therefore save your project in a folder that is not shared with the host os (for example C:/hololens or something like that).
Step 3 is just pressing the build button in Unity.
Step 4 is easy if Unity compiled without any errors, Unity should open a Windows explorer window with the Visual Studio output project in it. Open this project with Visual Studio.
Step 5 gave a lot of problems too. The first thing to do is edit the file called Package.appxmanifest, find the line with TargetDeviceFamily and change the following two attributes: Name=”Windows.Holographic” and MaxVersionTested=”10.0.10586.0″. Change the build configuration dropdown to Release and change the platform configuration dropdown to x86. This should be enough to compile and run the app on the emulator or device, however I had problems getting the device to accept my build and after a lot of poking around I found out that Visual Studio does some magic trickery when pairing the device with the development computer using a PIN code. If you already paired the HoloLens and the development computer with a PIN code outside of Visual Studio, you must first unpair them in the HoloLens settings menu, then build the project in Visual Studio and wait for it to ask for the PIN code, generate the PIN code with the HoloLens and type it in. This should not be a problems if the deviec and computer was unpaired before or if running on the emulator.
Now everything should work and the app should run.
Documentation in Visual Studio
A final note. If you are using Visual Studio for code editing it might be very handy with some Unity documentation inside Visual Studio. In order to get that, you must install the Tools for Unity package and restart Visual Studio:
https://visualstudiogallery.msdn.microsoft.com/8d26236e-4a64-4d64-8486-7df95156aba9
After restarting Visual Studio you can assign a keyboard shortcut to Help.UnityApiReference in Tools -> Options under Environment -> Keyboard.