Unity development overview

To get started building holographic apps with Unity, install the HoloLens development tools which include the Unity HoloLens Technical Preview. The Unity HoloLens Technical Preview is based off of the Unity 5.4 builds. Be sure to check back regularly for updated Unity builds.

The fastest path to building a holographic app for HoloLens is with Unity. We recommend you take the time to explore the Unity tutorials. If you need assets, Unity has a comprehensive Asset Store. Once you have built up a basic understanding of Unity, you can visit the Holographic Academy to learn the specifics of holographic development with Unity. Be sure to visit the Unity HoloLens forums to engage with the rest of the community building holographic apps in Unity and find solutions to problems you might run into.

Adding holographic capabilities and inputs

Standard Unity game objects (such as the camera) will work immediately for holographic apps, with the camera's position updated automatically as the user moves their head through the world.

Adding support for Windows Holographic features such a gesture or voice input is achieved using APIs that are already built into Unity.

This includes the core building blocks for holographic apps, exposed in a manner consistent with other Unity APIs:

There are other key features that many holographic apps will want to use, which are also exposed to Unity apps:

Configuring a Unity project for HoloLens

There is a small collection of Unity settings that needs to be changed for HoloLens, and are broken down into two categories: per-scene and per-project.

Per Scene Settings

Unity camera settings
Settings for a holographic camera
The Unity Camera component handles head tracking and stereoscopic rendering. There is no need to replace it with a custom camera to do this. There are a few settings that need to be changed to get the camera to work as a holographic camera for HoloLens.

  1. In the Hierarchy, select the Main Camera
    1. In the Inspector panel, set the transform position to 0, 0, 0 so the location of the users head starts at the Unity world origin.
    2. Change Clear Flags to Solid Color.
    3. Change the Background color to RGBA 0,0,0,0. Black renders as transparent in HoloLens.
    4. Change Clipping Planes - Near to the HoloLens recommended 0.85 (meters).

If you delete and create a new camera, make sure your camera is Tagged as MainCamera.

For more details about holographic rendering, see the Rendering article.

Per Project Settings

For an app to take advantage of certain functionality on HoloLens, it must declare certain capabilities in its manifest. The manifest declarations can be made in Unity so they are included in every subsequent project export. The setting are found in Player Settings > Windows Store > Publishing Settings > Capabilities. The applicable capabilities for enabling the commonly used APIs for Holographic apps are:

Capability API's requiring capability
WebCam PhotoCapture and VideoCapture
SpatialPerception SurfaceObserver and SpatialAnchor
Microphone VideoCapture, DictationRecognizer, GrammarRecognizer, and KeywordRecognizer
PicturesLibrary / VideosLibrary / MusicLibrary PhotoCapture and VideoCapture (for still photos, video, and audio respectively)
InternetClient DictationRecognizer (and to use the Unity Profiler)

We need to also specify our Unity project to export as a Universal Windows Platform app.

  1. Select File > Build Settings...
  2. Select Windows Store in the Platform list.
  3. Set SDK to Universal 10
  4. Set Build Type to D3D.

Unity quality settings
Unity quality settings
Since maintaining high framerate on HoloLens is so important, we want the quality settings tuned for fastest performance.

  1. Select Edit > Project Settings > Quality
  2. Select the dropdown under the Windows Store logo and select Fastest. You'll know the setting is applied correctly when the box in the Windows Store column and Fastest row is green.

Finally, we need to let Unity know that the app we are trying to export should create a holographic view instead of a 2D view. We do that by adding HoloLens as a virtual reality device.

  1. From the Build Settings... window, open Player Settings...
  2. Select the Settings for Windows Store tab
  3. Expand the Other Settings group
  4. In the Rendering section, check the Virtual Reality Supported checkbox to add a new Virtual Reality Devices list and confirm "Windows Holographic" is listed as a supported device.

Unity documentation

In addition to this documentation available on the Windows Dev Center, Unity installs documentation for Windows Holographic and HoloLens functionality alongside the Unity Editor. The Unity provided documentation includes two separate sections:

  1. Unity scripting reference
    • This section of the documentation contains details of the scripting API that Unity provides.
    • Accessible from the Unity Editor through Help > Scripting Reference
  2. Unity manual
    • This manual is designed to help you learn how to use Unity, from basic to advanced techniques.
    • Accessible from the Unity Editor through Help > Manual

See also