Unity MRTK2 Hololens Development Setup

by SlideFactory

“Follow along to gather all the necessary dependencies to build and deploy a Unity app to Hololens using the Mixed Reality Toolkit 2 (MRTK2)”

Overview

In this article we are going to be gathering the necessary dependencies to build and deploy a Unity app to Hololens using the Mixed Reality Toolkit 2 (MRTK2). The MRTK 2 supports both Hololens 1 and 2 as well as OpenVR. However, building to the Hololens requires a Windows OS to install the Windows SDK.

Video Walkthrough

If you are a visual learner, check out the video that walks through the core concepts of this post:

MRTK2 Requirements with Unity

When using Unity and MRTK2 we’ll need the following items:

  • Unity 2018.4 LTS, 2019.1.x or 2019.2.x – In this post we will be using the latest version of Unity 2019.2.
  • Visual Studio 2019 – MRTK2 for Hololens requires the Windows SDK 10.0.18362. The easiest way to set this up is installing VS 2019, which we cover below.
  • Unity UWP Build Support – Needed for Unity to build to Hololens as a Platform.
  • Developer Mode – Lets us build and deploy to Hololens.
  • Holographic Remoting Player (Optional) – This lets us quickly run Unity’s Play Mode directly on our Hololens device.

Windows Updates

Before we get started, we’ll need the latest Windows Updates on both our PC and Hololens. Go to Settings -> Update & Security -> Windows Updates and click Check for Updates. Once we’re up to date, we are ready to move on.

Visual Studio Tools

We recommend installing Visual Studio 2019 through the Visual Studio Installer to easily add all of the dependencies for Hololens development. When installing, make sure to check the .NET desktop development, Desktop development with C++ and Universal Windows Platform development workloads. Under the Universal Windows Platform development optional packages, check C++ (v142) Universal Windows Platform tools. If you already have VS 2019, you can run the VS Installer and click Modify by VS 2019 to add the components.

Unity MRTK2 required workloads and packages
Check the needed workloads and packages

Once you have VS 2019 and its workloads installed, you may want to set it as Unity’s editor. To do this, go into Unity and under Edit -> Preferences -> External Tools change the External Script Editor to Visual Studio 2019. If it’s not an option you can Browse to the .exe and open it. (Ours is under D:/VisualStudio/2019/Common7/IDE/dotenv.exe, yours may differ)

Adding Unity’s UWP Platform Module

The easiest way to install Unity’s UWP Build Support is by using Unity Hub. Under the Installs tab, click on the three dots at the top right of your Unity installation, then click Add Modules. For Unity 2019, there is one option Universal Windows Platform Build Support. For Unity 2018, there are two, UWP Build Support (.NET) and UWP Build Support (IL2CPP). The choice is up to you, .NET Build Support is no longer in Unity after 2018 and was replaced by IL2CPP. The .NET module builds faster and allows C# script editing in the Visual Studio Solution that Unity builds to.

Enabling Developer Mode for Unity MRTK2 Building and Deploying

You will need to set this up on both you PC and Hololens. First, go into Settings -> Updates & Security -> For Developers and then turn Developer Mode. You can turn on Enable Device Portal on your Hololens, if you’d like to connect to it through Windows Device Portal. However, this isn’t necessary to build over USB.

Installing Holographic Remoting Player

The Holographic Remoting Player app lets us quickly test our Unity scene through Play mode directly on our Hololens. This is very helpful to quickly test our app. Make sure your Hololens is fully updated, then go to the Microsoft Store and install the app. You can also do this directly on your Hololens.

Wrap Up

In conclusion, we have installed everything we need to begin Hololens development with Unity using MRTK2! Now you are ready to create a simple Hololens app with Unity.

Checkout our tutorial here to get started. This is hidden

Share this article:

You might also like: