Quickstart: Deploy Unity sample to HoloLens

This quickstart covers how to deploy and run the quickstart sample app for Unity to a HoloLens 2.

In this quickstart you'll learn how to:

  • Build the quickstart sample app for HoloLens
  • Deploy the sample to the device
  • Run the sample on the device

Prerequisites

In this quickstart, we'll deploy the sample project from Quickstart: Render a model with Unity. Make sure your credentials are saved properly with the scene and you can connect to a session from within the Unity editor.

The HoloLens 2 must be in developer mode and paired with the desktop machine. Refer to using the device portal for further instructions.

Build the sample project

  1. Open File > Build Settings.
  2. Change Platform to Universal Windows Platform
  3. Set Target Device to HoloLens
  4. Set Architecture to ARM64
  5. Set Build Type to D3D Project
    Build settings
  6. Select Switch to Platform
  7. When pressing Build (or 'Build And Run'), you'll be asked to select some folder where the solution should be stored
  8. Open the generated Quickstart.sln with Visual Studio
  9. Change the configuration to Release and ARM64
  10. Switch the debugger mode to Remote Machine
    Solution configuration
  11. Build the solution
  12. For the project 'Quickstart', go to Properties > Debugging
    1. Make sure the configuration Release is active
    2. Set Debugger to Launch to Remote Machine
    3. Change Machine Name to the IP of your HoloLens

Launch the sample project

  1. Connect the HoloLens with a USB cable to your PC.
  2. Start the Debugger in Visual Studio (F5). It will automatically deploy the app to the device.

The sample app should launch and then start a new session. After a while, the session is ready and the remotely rendered model will appear in front of you. If you want to launch the sample a second time later, you can also find it from the HoloLens start menu now.

Next steps

In the next quickstart, we'll take a look at converting a custom model.