Augmented Reality
September 10, 2020
5 minutes

Hololens 2 Setup Guide


Dejan Gajsek

Are you ready to develop your first augmented reality application for HoloLens 2?

We got you. And the first thing we need to do is to set up your development environment.

In this guide we’ll show you step by step how to install, configure, and launch everything you need to start building awesome applications for HoloLens 2.

HoloLens 2 Development Setup Overview

We’ll be setting up our development environment using Unity 3D game engine and the most recent Microsoft's mixed reality headset — HoloLens 2.

If you don’t own a headset, that's not a problem: we’ll show you how to set up a HoloLens 2 Emulator so you can test your augmented reality application directly on your computer.

If you're looking for the guide on the first version of HoloLens - check this guide here.

If you have a HoloLens 2 headset and don’t need an emulator, skip directly to the “How To Set Up HoloLens 2 Project in Unity” section.

Setting Up HoloLens 2 Emulator

If you don’t have a HoloLens 2 headset, you still can develop your augmented applications as everyone else and run them on your PC using HoloLens 2 Emulator.

You can download the latest version of emulator from Microsoft website. You will need to install the most recent version of Visual Studio as well.

Here are the main requirements to run HoloLens 2 emulator on your PC:

  • Windows 10 Pro, Enterprise, or Education 64-bit system
  • Windows 10 October 2018 update or later
  • 8 GB of RAM
  • Hyper-V enabled You can find the full list of requirements on Microsoft webpage.

Step-by Step Instructions To Set Up Hololens 2 Emulator

Below are step-by-step instruction to install Hololens 2 emulator on your PC:

  1. Enable Hyper-V feature through Control Panel -> Programs -> Programs and Features -> Turn Windows Feature on or off -> turn on “Hyper-V” Img
  2. Ensure that your Windows 10 is up to date with Windows 10 Fall Creator Update. This update is installed automatically with other OS updates, or manually install the updates here.
  3. Download and install the latest version of Visual Studio.
  4. Download and install Windows 10 SDK. Note: the most stable version if Windows 10 SDK for running MR applications for HoloLens 2 is currently 10.0.18362.0
  5. Download or update to the latest version of Unity (currently 2019.4). The long-term support builds are preferable (currently 2019.4.X)
  6. Download and install the HoloLens 2 Emulator
  7. Download Windows Mixed Reality Toolkit from Github. Save it to a devoted folder as later we’ll be importing the toolkit directly into Unity.

How To Set Up HoloLens 2 Project in Unity

To build our HoloLens 2 application we will use Unity game engine. Follow these steps to configure and build a Unity project for HoloLens 2.

  1. Open Unity and create new 3D project Img

  2. Open File - Build Settings and switch the platform to Universal Windows Platform. Change the target device to HoloLens. If you are using the Unity 2019 version, make sure to change the Architecture to ARM64. Make sure your minimum platform version is set to 10.0.18362.0.Note: Don’t forget to click Add Open Scenes if you already have a project that you’re ready to build and test on your HoloLens 2 device or emulator. The rest of the settings should be configured as shown with the screenshot below. Finally, press Switch Platform. Img

  3. Let’s add Microsoft Mixed Reality Toolkit (MRTK) into our Unity project. Download the Microsoft.MixedReality.Toolkit.Unity.Foundation.2.4.0.unitypackage file from the Microsoft’s Github page. Img After you finished downloading the file, open your Unity project again and click Assets - Import Package - Custom Package to locate the toolkit package on your hard drive.After you locate the file, click Import. Img

  4. After you’ve imported the package into your Unity HoloLens 2 project, the following window will pop up: Img Make sure all three boxes below are checked and click Apply.

  5. Finally, let’s see if our Unity project settings are in check. Click Edit - Project Settings and change the following parameters: Player - XR Settings - check if Windows Mixed Reality is added to Virtual Reality SDKs panel. If not, add it manually using the “+” icon. Img After that change the following settings: Player - XR Settings - Virtual Reality SDKs - set 16-bit depth Player - Other Settings - Rendering - uncheck Graphics Jobs

  6. It’s time to create your augmented reality scene. Open Mixed Reality Toolkit menu in Unity and choose the Add to Scene and Configure option. Img This action will create two game objects within your Unity scene that are both critically important for your app to function: MixedReality Toolkit and Mixed Reality Playspace.

How To Deploy Your App on the HoloLens 2 Emulator for Testing

  1. After you finished building your project in Unity, locate the project folder and open the .sln file with Visual Studio.
  2. Select x86 or x64 build configuration
  3. Select HoloLens 2 Emulator as the target device for debugging

Img (Source)

  1. Press F5 or Open Debug - Start Debugging to launch the emulator and deploy your application for debugging. Img (Source) HoloLens 2 Emulator interface

Now you can start testing your mixed applications!

How To Deploy Your App on the HoloLens 2 Device For Testing

If you have a HoloLens 2, you need to perform a few extra steps to test your application with your headset.

  1. Connect your HoloLens 2 device to the computer via USB.
  2. Change build configuration to ARM or ARM64 in Visual Studio Img
  3. Choose Device option in the Device section
  4. The first time you deploy an app onto your Hololens 2 device you’ll be asked to enter a PIN code. To generate a PIN code by launching the Settings app on your device and go to Update - For Developers - Pair. Now your HoloLens 2 is paired with your computer so all the apps can be deployed automatically.
  5. Select Debug - Start Debugging to deploy your application and test it.

And that’s it!

Now you know how to set up the development environment for HoloLens 2 and deploy applications onto the HoloLens 2 headset or emulator.

You can start adding complex objects, animations, and scripts to enrich your augmented reality scenes and create unique business and entertaining applications.

“That’s all cool, but where can I learn to develop an actual mixed reality application?”

We got you here as well.

Register for the XR Development course.

XR Development Course

Upskill in 10 weeks and get to developing your own AR and VR applications.

Share this