Unity
XR

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.

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.

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.

Looking for a reliable partner for your next project?

At SLIDEFACTORY, we’re dedicated to turning ideas into impactful realities. With our team’s expertise, we can guide you through every step of the process, ensuring your project exceeds expectations. Reach out to us today and let’s explore how we can bring your vision to life!

Contact Us
Posts

More Articles

Vision Pro Headset
Contact Us

Need Help? Let’s Get Started.

Looking for a development partner to help you make something incredible?

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.