Last time, I created a simple Hello World project in Unity 5 for the HoloLens. This time, I’ll deploy it to the HoloLens Emulator.

There’s a few other things I’ll look at as well – how to use the Emulator from your keyboard, and some hints on setting up your Unity HoloLens project for a code versioning system.

Building your Unity HoloLens project

Now that we have created and saved our Unity project, we’re ready to deploy it to our HoloLens. Inside the Unity environment, open the File menu and select “Build Settings…”.

screenshot.1468616434

This will open a screen similar to the one below. I’ve modified some of the settings:

  • I clicked on the “Add Open Scenes” to add the default “Hello World” scene;
  • I selected the platform “Windows Store”;
  • I’ve changed the SDK to “Universal 10”;
  • I’ve changed the UWP Build Type to D3D;
  • Finally I’ve checked the box beside “Unity C# Projects”.

screenshot.1468616326

Next, click on the button saying “Player Settings…” – the Inspector view will appear on the main Unity development environment.

screenshot.1468618370

The most important property page is “Other Settings”. Make sure that the “Virtual Reality Supported” box is ticked, and that the value under “Virtual Reality SDKs” is “Windows Holographic” (I’ve highlighted this in red below).

screenshot.1468618700

Now click on the “Build” button on the “Build Settings” window, which should still be on top of the Unity IDE. You’ll immediately be shown a folder dialog box, asking you to select a folder in which to create the Visual Studio project. I normally choose to create a folder named “App” alongside the other folders in the Unity Project. Choose this folder and hit the “Select Folder” button.

screenshot.1468619335

A few windows will pop up showing progress bars, and eventually a Windows Explorer window appears with the folder “App” selected. I opened the “App” folder, and double clicked on the “HelloWorld.sln” file, to open the solution in Visual Studio 2015.

Deploying to the emulator

When Visual Studio opens, ensure that the “Release” configuration is chosen, targetting the x86 architecture. I’ve selected the HoloLens Emulator as a deployment device, rather than a HoloLens.

screenshot.1468620806

After clicking on the button to start the HoloLens Emulator, the emulator starts but I see a warning message (shown below).

screenshot.1468621830

I select “Continue Debugging”, and the application starts in the emulator, showing a sphere orbiting the planet.

screenshot.1468622276

Using the emulator

The emulator is obviously not a perfect substitute for the real HoloLens hardware, though it’s still pretty good. One of the things I initially found difficult was how to navigate around the virtual world. If you’re familiar with gaming on a keyboard you’ll probably find it quite easy – forward, back, left and right can be controlled by W,S,A and D, and looking up, down, left and right can be controlled by the corresponding keyboard arrow keys.

I personally don’t really like using the keyboard to control the emulator, and fortunately an alternative option is to connect an Xbox 360 controller to my PC by USB – I find the game controller a much easier way to navigate in the virtual world.

There’s a set of instructions on how to use the emulator at this link, and full details on advanced emulator control at this link.

The emulator even offers an online device portal, available by clicking on the globe icon in the list of icons on the top right of the emulator – this just opens up a site in a browser, as shown below. There’s more information on how to use the device portal at this link.

screenshot.1468700023

All the information and functions available through the device portal are also available through a RESTful API – so for example, to see the device battery status, you can browse to:

http://<your device’s IP address>/api/power/battery

and the response will be a JSON representation of your battery status.

Full details of the RESTful API are available at this link.

Wrapping up

So in the last three posts, we’ve:

We’ve also looked at how to use the emulator, and how to see its Device Portal.

Next time, I’ll look at preparing our code for a code versioning system such as Subversion or GitHub.