You are on page 1of 12

How to Set Up Your HoloLens in

Developer Mode for Unity and Build AR


Apps
Fuente:

https://circuitstream.com/hololens-unity-setup/

This Unity tutorial will take you through step-by-step so you can start developing for HoloLens.
Once your device is ready in developer mode, you can start building your own augmented reality
application in Unity.

https://youtu.be/7sAouB7_V8Y

Setting Up and Testing on a HoloLens


Emulator

If you don’t have a HoloLens, you’ll want to download an emulator so you can test your
application as you build.

The HoloLens emulator runs through Visual Studio. You can download the emulator here, and
Visual Studio here. Note that the emulator will not work on Windows 10 Home OS. You’ll need
Windows 10 Pro, Enterprise, or Education. You can check your system OS in your Settings
window under ‘About’.

If you don’t want to setup the emulator, you can skip ahead to setting up a Unity project for
HoloLens.

To setup your HoloLens Emulator:


It’s possible to develop for the HoloLens without actually owning one. But, you’ll need to
download the emulator for testing purposes. Here’s how:

1. Head into your Control Panel, and navigate to Programs, then Programs and Features. Click on
the link on the left-hand side labeled Turn Windows Features On or Off. In the pop-up window,
enable Hyper-V.

2. Make sure your Graphics Card is up to date. You can update your driver using Device Manager.
Navigate to Start, to Device manager, then to Display Adapters. Select your Graphics Card, and
the option to Update Driver.

3. We’ll want to ensure the Windows 10 Fall Creator Update is installed. It should have occurred
automatically in your normal OS updates. To install manually follow this link and the instructions
on the screen. (https://www.microsoft.com/en-us/software-download/windows10)

4. Confirm that you have the latest version of Visual Studio installed. You can find the latest
version here. (https://www.visualstudio.com/downloads/)

5. Install the Windows 10 SDK at this link here. (https://developer.microsoft.com/en-


US/windows/downloads/windows-10-sdk)

6. Install or Update to the latest version of Unity (Unity 2017.4 or above). You’ll want to confirm
that you have the following components selected: Windows Store .NET Scripting Backend;
Windows Store IL2CPP Scripting Backend; and Vuforia Augmented Reality Support.

HoloLens Unity Download Components

7. Download the HoloLens Emulator here. (https://go.microsoft.com/fwlink/?linkid=852626)


8. Lastly, download the Windows Mixed Reality Toolkit from the GitHub repository here.
(https://github.com/Microsoft/MixedRealityToolkit-Unity) As you might know, you’ll be
downloading a lot of SDKs and Toolkits throughout the development process so it’s a good idea
to have a special folder where you’ll save and store them.

Setting up Unity to Start Developing for HoloLens


After finishing download the programs you need to run your emulator, you’re ready to get
started in Unity.

1. Open Unity and create a new 3D project

2. Navigate to File and into your Build Settings and confirm the settings are as follows (pictured
below): Your platform is set to Universal Windows Platform, with your Target Device set to
HoloLens, Build Type as D3D, SDK and Visual Studio set to Latest Installed, and that you’re set to
Build and Run on Local Machine. Once you’re set, select Switch Platform.

3. Select Player Settings and navigate to XR Settings, then add your Mixed Reality SDK
4. Head back to Player Settings and navigate to Other Settings, and confirm your Configuration is
as pictured below:

5. Navigate to Publishing Settings and then to Capabilities. We’ll want to enable InternetClient,
Microphone, and SpatialPerception.

6. If you haven’t already, download the Windows Mixed Reality Toolkit here.
(https://github.com/Microsoft/MixedRealityToolkit-Unity)

7. We’ll bring the HoloToolkit folder from the Mixed Reality Toolkit into Unity. First, we’ll unzip
the Windows Mixed Reality Toolkit. Open your Unity Assets folder and drag the HoloToolkit
folder into the Project’s Assets folder. Once linked, the Mixed Reality Tab should appear on the
top of your Unity menu bar alongside File, Edit, GameObject, etc.

8.Now navigate to Mixed Reality Toolkit menu to Configure and Mixed Reality Project Settings.
Confirm you have the following checkmarked, then select apply.
9. You’re doing great! We’ll head back into Unity’s main window, and delete the default camera
from your hierarchy tab. Along the bottom window navigate to HoloToolkit > Input > Prefabs and
drag your HoloLensCamera into your hierarchy tab. Save your scene!

10 Lastly we’ll navigate to File and to Build Settings, select Open Scenes, and Build into a
separate folder.
You’re now ready to start developing in Unity! But before hitting play, let’s confirm the HoloLens
emulator is working with your Unity project. If you’re deploying your app onto an actual
HoloLens device, we have instructions for you here. (https://circuitstream.com/hololens-unity-
setup/#hololensdeploy)

Download our 10-week VR Development with Unity Course Syllabus

(https://signup.circuitstream.com/syllabus)

Deploying your app onto the HoloLens Emulator for


testing
To make sure the emulator is working, let’s add a 3D Object into your scene. You can do this in
Unity by right-clicking on the Hierarchy tab and selecting a 3D Object, let’s say a 3D rectangle.
Then save and close Unity.

1. Open your .sln project into Visual Studio. Set the Debug settings as shown below. If you have
the emulator setup correctly, you should be able to see the option in the dropdown menu on the
right.

2. HoloLens emulator debug settings

3. Navigate to the Debug menu and select Start Debugging. This should bring up the emulator.

Users navigate HoloLens applications using hand gestures. In an emulator, we use keys to
simulate these gestures. The F2 key acts as the “Bloom” gesture. The enter key works as the “Air
Tap” gesture. You can move around the computer mouse to emulate the “Gaze” interaction.
Using these keys, open your application and it should load similar to what’s below:

Great job! You can now test, (re)build, and test again and again until you’re confident in your
application.

Deploying your app onto the HoloLens for testing


If you are testing your application on an actual HoloLens instead of an emulator, there’s a few
extra steps to ensure your HoloLens is setup in Developer Mode.

1. Enable Developer Mode on your desktop by navigating to your Settings, selecting Updates and
Security, and clicking For Developers on the menu to your left. Confirm Developer Mode is on,
and enable remote diagnostics and authentication, as seen below:

2. Next, connect your HoloLens to your computer through its USB cord. When you start your
HoloLens, you’ll want to re-open your desktop’s Settings window, head into Updates and
Security, For Developers, and turn Developer Mode ON for your HoloLens.

3. Now we’ll pair your HoloLens with your computer. Your computer will ask for a Pin that you’ll
generate on your HoloLens. Scroll down to Device Portal and click Pair to Generate Pin. Activate
bluetooth on your HoloLens.

4. Pair HoloLens with your computer through your Settings window, to Devices, and selecting
Add Bluetooth or Other Device. This is when you’ll need to input your HoloLens pin.
5. You’re almost there! After the pairing completes, open the project as .sln in Visual Studio.
Configure the Debug settings as shown below, then navigate to the Debug menu and Start
Debugging.

The application should now show up on your HoloLens. Once you do this, you can even start
your application on HoloLens directly by running on Unity.

Help! HoloLens Troubleshooting

Don’t panic! In some cases, you may need to select Release instead of Debug. If Start Debugging
gives an error saying you need to deploy the app first, navigate to Build in the menu bar and
deploy from there instead. Other deployment errors are often fixed by deleting your .sln file and
rebuilding from within Unity, but hopefully it doesn’t come to that!

Whether you’re building for augmented or mixed reality, Microsoft HoloLens is a great device to
work with. Now that you’re setup, you’re ready to get building. Check out our programming
guides for further resources. (https://circuitstream.com/programming-development-guides/)

Tired of learning on your own, download our syllabus and see how we can help you build a
working prototype in just 10-weeks through small classes, live online training, and one-on-one
sessions with instructors.

Technical Steps:
Emulator Setup:
1. Go to Control Panel > Programs > Programs and Features > Turn Windows Features On or Off,
then enable Hyper-V

2. Update Graphics Card

3. Install Windows 10 Fall Creator update here


4. Install/update Visual Studio here

5. Install Windows 10 SDK here

6. Install/update Unity and confirm you have selected:

6.1 Windows Store .NET Scripting Backend;

6.2 Windows Store IL2CPP Scripting Backend; and

6.3 Vuforia Augmented Reality Support

7. Download HoloLens emulator here

8. Download Windows Mixed Reality Toolkit from GitHub here

Basic Unity Setup for HoloLens:

1. Startup Unity and create new 3D project

2. Go to File > Build Settings and change settings to below, select Switch Platform

2.1 Universal Windows Platform

2.2 Target Device set to HoloLens

2.3 Build Type set to D3D

2.4 SDK set to Latest installed

2.5 Visual Studio Version set to Latest installed

2.6 Build and Run on Local Machine

3. Go to Player Settings > XR Settings and add Mixed Reality SDK

4. Go to Player Settings > Other Settings and change Configuration to:

4.1 Scripting Runtime Version set to Stable (.NET3.5 Equivalent)

4.2 Scripting Backend set to .NET

4.3 API Compatibility Level set to .NET

4.4 Accelerometer Frequency set to 60 Hz


5. Go to Publishing Settings > Capabilities and have checkmarked:

5.1 InternetClient

5.2 Microphone

5.3 SpatialPerception

6. Download Windows Mixed Reality Toolkit here if not already downloaded

7. Unzip Mixed Reality Toolkit; import HoloToolkit into Project’s Asset folder; Mixed Reality
Toolkit will now appear in Unity menu bar

8. In Unity, navigate to Mixed Reality Toolkit menu bar > Configure > Mixed Reality Settings and
select:

8.1 Target Windows Universal UWP

8.2Enable XR

8.3 Build for Direct3D

8.4 Use Toolkit-specific InputManager axes

8.5 Enable .NET scripting backend

9. Delete default camera in hierarchy tab; add HoloLensCamera into hierarchy tab from
HoloToolkit prefabs folder

10. Save scene; go to Build Settings > Add Open Scenes > Build into a separate folder

Deploying and Testing App on Emulator:

1. Open .sln project in Visual Studio. Set Debug settings to x86 and HoloLens emulator in drop
down menu.

2. Go to Debug > Start Debugging to bring up emulator

3. F2 key acts as “Bloom” gesture; Enter key acts as “Air Tap” gesture; mouse acts as “Gaze”
interaction. Use these keys to open app.
Deploying and Testing App on HoloLens:

1. Enable Developer Mode on Computer:

1.1 Navigate to Settings > Updates and Security > For Developers, and enable Developer Mode,
remote diagnostics, and authentication

2. Connect HoloLens to Computer

3. Once HoloLens is connected, on computer go to Settings > Updates and Security > Developer
Mode > For Developers > Turn Developer Mode ON

4. Pair HoloLens to Computer:

4.1 Navigate to Device Portal > Pair > Generate Pin

4.2 Activate bluetooth with HoloLens at Settings > Devices

4.3 Pair HoloLens to Computer via Settings > Devices > Add Bluetooth or Other Device. Input
HoloLens Pin when prompted

5. Open project .sln in Visual Studio. Set Debug settings to x86 and Device in drop down menu

HoloLens Deployment Troubleshooting:

1. May need to select Release instead of Debug

2. If Start Debugging gives error saying you need to deploy app first, go to Build menu and
deploy from there

3. Delete .sln file and rebuild in Unity

You might also like