Step by step HoloLens 1 with Unity and Visual Studio Tutorial

Moira Walker
11 min readMar 25, 2019

--

As a Graphic Design student being interested in combining (new) technologies and design, I wanted to use the HoloLens for one of my graduation projects. I didn’t have any experience with the HoloLens, Unity or Visual Studio. The whole process of getting a simple project up and running took me more time than I had hoped. Although there are some tutorials available on Youtube, I felt that they were missing information, not showing the whole process for people who don’t have a technical background. On Microsoft Docs there is a lot of information available about the HoloLens, but it’s easy to get lost in the information overload.

For those reasons, I decided to make this tutorial for people who want to get a simple project started with the HoloLens and don’t have a technical background. In the end, it’s not that difficult to get a HoloLens project set up and running, you just have to know exactly which steps you need to follow. I have tried to make this tutorial as accurate and clear as possible, please leave a comment behind if something is unclear so I can update the article.

This is a tutorial for the HoloLens 1 so not for the recently released HoloLens 2.

Index

Step 1— Unboxing the HoloLens
Step 2 — Downloading and Installing
Step 3 — Connecting HoloLens To computer With USB
Step 4 — Unity
Step 5— Visual Studio
Step 6— Toolkit

Step 1 — Unboxing the HoloLens

1.1 Unzip the HoloLens cover. Inside you will find the HoloLens, a charger, USB cable, manual and Bluetooth clicker.

1.2 Next are some visual instructions to indicate the buttons on the HoloLens. If you successfully pushed the power button, lights will appear just above the power button, which indicate battery life. If you don’t see any lights it means the HoloLens is still turned off. If the lights are flashing, you have to charge the HoloLens by USB cable in combination with the power charger.

Figure 1.2 A
Figure 1.2 B

1.3 Below are some visual instructions to show you how to adjust the HoloLens for a comfortable fit. If you are still confused click here for a video.

1.4 Click here for a video that introduces you to how to wear the HoloLens and how to control the interface menu using hand gestures.

1.5 Now it’s time to get started! Push the power button (see 1.2 if you want to know where the power button is located) and place the HoloLens on your head. After a few seconds, you will see a screen projecting “hello” in front of you. If your HoloLens is already installed, you will see the HoloLens interface in front of you. If your HoloLens isn’t installed yet, the HoloLens will guide you through the installation process.

1.6 If you want to know more about the controls and gestures for the HoloLens click here.

Step 2 — Downloading and Installing

To use the HoloLens, you need a Windows computer operating on Windows 10. Since the HoloLens is from Microsoft, it does not work on IOS.

2.1 Go to this page to download Unity Personal. When going through the installation you arrive at the Choose Components window, make sure to enable Windows Build Support (IL2CPP) and Unity 2018. You can optionally select Vuforia Augmented Reality Support. With Vuforia you can connect markers on real-world objects with the HoloLens. For a tutorial about Vuforia markers for HoloLens click here. If you are still unsure, the video below will take you through the steps.

Video 2.1

2.2 Go to this page to install Visual Studio Community 2017. Don’t worry, this is a free program. Make sure you install the Windows version (and not for MacOS).

2.3 When you have downloaded Visual Studio, follow the instructions to install the program. At some point, the Visual Studio Installer menu will appear. Under the tab “Workloads” you can enable the checkbox “Universal Windows Platform development” and (if you scroll down a bit further) “Game Development with Unity”. Then press the “Install” button (bottom right). After the installation a reboot is required, you have to restart your computer to complete the installation. If you are still unsure, the video below will take you through the steps.

Video 2.3

If you already have installed Visual Studio and are not sure if you have downloaded the correct workloads: open Visual Studio installer, then select “Modify” to come in the “Workloads” window.

Step 3 — Connecting HoloLens to a computer with USB

3.1 Turn the HoloLens on and fit the device on your head.

3.2 Perform the bloom gesture to launch the main menu.

3.3 Gaze at the Settings tile and perform the air-tap gesture. Perform a second air-tap to place the app in your environment. The Settings app will launch after you place it.

3.4 Select the Update menu item

3.5 Select the For developers menu item.

3.6 Enable Developer Mode.

3.7 Scroll down and enable Device Portal.

3.8 If you are setting up Windows Device Portal so you can deploy apps to this HoloLens over USB or Wi-Fi, click Pair to generate a pairing PIN. Leave the Settings app at the PIN popup until you enter the PIN into Visual Studio during your first deployment.

If you are still unsure, the video below will take you through the steps.

Video 3.2–3.8

3.9 Connect the USB cable with the HoloLens and the USB cable of your computer, check if the HoloLens is still on by putting it on your head. Now open your internet browser and go http://127.0.0.1:10080
If it doesn’t connect, you can try using the USB3 port. Sometimes this works, but not always. I don’t know why.

3.10 Your browser will ask you for a username and password. If you don’t yet have a username or password, create it.

3.11 Some examples of cool things you can do in the device portal:
record video’s of your HoloLens view, make photos, track the environmental 3D space that the HoloLens is capturing, enable live-preview and manage the standby time of the HoloLens. If you want to know more about what you can do with the Device Portal go to https://docs.microsoft.com/en-us/windows/mixed-reality/using-the-windows-device-portal#device-portal-pages

Note: Step 3.1–3.7 are copied from the Microsoft Docs site, so credits to Microsoft for writing those steps. I thought it would be more clear to have the whole process and my added instructions in one module in this guide. Also on the Microsoft site, the IP address is at the end of a sentence ending with a dot. This could be confusing, so in my tutorial, I only used the IP address.

Step 4 — Unity

4.1 Open the Unity program. Log in with your account, if you don’t have one yet create one and then log in. Choose Unity Personal under Licence management. Create a new project and name it. When everything is filled in click on Create project.

Screenshot 4.1

4.2 Under Hierarchy (at the top-left of the interface) select Main Camera by clicking on it once.

Screenshot 4.2 A

Then go to the Inspector, on the right side of the interface. Underneath Camera you see a drop-down menu with Skybox, change this to Solid Color. Next, you should select Background and choose the color black (hexadecimal 000000).

Screenshot 4.2 B

4.3 Under Game object (in the bar on the top) select 3d Object and then select Cube (or any other 3d Object you like).

Screenshot 4.3 A

If you click on Main Camera under the Hierarchy you can see the Camera Preview in the bottom right of the interface. You can position the Cube or the Main Camera to get the Cube centered in the Camera Preview with the Move tool.

Screenshot 4.3 B

4.4 Go to file and then to save as, then name the file in the folder Scenes.

4.5 Under Edit select Project Settings and then select Quality in the window that pops up. Under Quality select Very Low (if it is selected the background highlights into a darker grey).

Screenshot 4.5

4.6 Under File select Build Settings. In the Build Settings window under Platform (on the left side of the interface) select Universal Windows Platform and then Switch to this platform. If Universal Windows Platform SDK isn't installed, click on Install and then reopen unity.

Screenshot 4.6

4.7 Under Universal Windows Platform set the settings to:

Target Device: HoloLens
Architecture: x86
Build Type: 3D3
SDK: Latest Installed
Visual Studio Version: Visual Studio 2017
Build and Run: Local Machine
Build configuration: Release
Development Build: Enable

Screenshot 4.7

4.8 Still in the Build Settings window look at the top part of the window saying Scenes In Build and select Add Open Scenes to add the scene you are currently working in. You can add multiple scenes, for instance when making a game but for this tutorial we only need one scene.

Screenshot 4.8

4.9 In the left bottom in the Build Settings window you see a Player Settings button, press it.

Screenshot 4.9 A

Then on the right sight of your screen under the Inspector go to the Other settings tab. Under this tap scroll further until you find Capabilities and under this enable Spatial perception.

Screenshot 4.9 B

You can also enable other options, but for this example, we only need Spatial Perception. Below is an overview of the options for the HoloLens:

Image 4.9 C

4.10 Go back to the Build Settings window and click on Build.

Screenshot 4.10 A

This will open up a window where you can create a new folder and save your file in it. It takes a while for the file to be built. When the build is finished you have to double click the .sln file in the folder you choose to build the project in. This will automatically open the project in Visual Studio.

Screenshot 4.10 B

Step 5— Visual Studio

5.1 If a popup screen appears in Visual Studio asking you to enable developer mode, enable developer mode.

5.2 Wait for the files to be loaded, you can see the progress in the bar at the bottom of the interface. If it is finished it will say Ready.

Screenshot 5.2 A
Screenshot 5.2 B

5.3 Change the settings of the top bar in Visual Studio to Debug, x86 and Remote Machine.

Screenshot 5.3

5.4 Look at the left of your screen under Solution Explorer and select the file where it says Universal Windows at the end.

Screenshot 5.4 A
Screenshot 5.4 B

Left click on this file and go to Properties at the bottom of the window and click on it, a window will open.

Screenshot 5.4 C

Under Configuration Properties, go to Debugging and then in Machine Name put 127.0.0.1 then click OK.

Screenshot 5.4 D

5.4 Attach the HoloLens to the computer with the USB cable. Click on the Remote Machine button, the app will start to build, this can take a while. Make sure the HoloLens is turned on while building the app. Sometimes the HoloLens can switch to standby with the result that Visual Studio can’t connect to the HoloLens anymore. I sometimes put the HoloLens on my head while building the app, so I get visual feedback of the HoloLens still being on.

5.5 If Visual Studio asks for a pairing code, you have to go to Settings of the HoloLens, then go to For Developers, scroll down and then click on Pair. I’ve demonstrated this in the previous video of step 3.8 of this tutorial. When you have generated a pin code, fill it in the window that is asking for the code in Visual Studio.

5.6 When the app is running you see the following screen in Visual Studio. The bar at the bottom is orange and you can pause or stop the app running with the controls I have highlighted in green.

Screenshot 5.6

5.7 Look through the HoloLens while still being connected to the computer with the USB cable. Unity will open automatically, followed by your project. Congratulations! You made it!

5.8 If you want to open the Unity project on the HoloLens after you disabled the USB cable, just go to the HoloLens interface by performing the Bloom gesture, click on All Apps (on the right of the interface), here you can find your Unity app, and open it by clicking on it.

5.9 If you want to make changes to the Unity project, you just have to save and build the unity project again. Visual Studio will ask if you want to reload the project. If it doesn't ask you, just open the project again by opening the .sln file again.

Step 6— Mixed Reality Toolkit

There is a Mixed Reality Toolkit available for Unity from Github. I haven't researched this, but it could be useful. The Mixed Reality toolkit is a collection of scripts and components intended to accelerate development of applications targeting Microsoft HoloLens and Windows Mixed Reality headsets.

You can also download HoloToolkit-Unity-Tests-v1.5.6.0.unitypackage
and import it in your Unity project. With this kit you can use several functions that can make creating projects for the HoloLens easier. I also haven’t really dived into this either. But I just want to let you know that these kits are available. You can let me know if you found something useful.

Feedback

I hope this instruction manual will help you in your HoloLens journey. If you have any feedback, cool projects you would like to share or other suggestions, please let me know :D

--

--