title | description | author | ms.author | ms.date | ms.topic | ms.localizationpriority | keywords |
---|---|---|---|---|---|---|---|
Unity development for HoloLens |
Get started building mixed reality apps in Unity and HoloLens with our curated checkpoint journey. |
qianw211 |
qianwen |
1/10/2022 |
article |
high |
Unity, mixed reality, development, getting started, new project, porting, capability, camera, simulation, emulation, documentation, mixed reality headset, windows mixed reality headset, virtual reality headset, what is virtual reality, what is augmented reality, MRTK, mixed reality toolkit, spatial mapping, voice input, locatable camera, emulator, Azure, tutorials |
Unity is one of the leading real-time development platforms on the market. Underlying runtime code is written in C++ and all development scripting is created using C#. Whether you're looking to build games, movies and animation cinematics, or even render architectural or engineering concepts in a virtual world, Unity has the infrastructure to support you. When you're ready to get started, head to the development checkpoints below!
Important
Take a look at our porting guides if you have an existing Unity project that you want to bring over to HoloLens 2. We have guides for projects that are using HTK, MRTK v1, or SteamVR.
Use the following checkpoints to bring your Unity games and applications into the world of mixed reality. If you haven't already explored the Designing Holograms sample application, we recommend downloading and using it to familiarize yourself with the basics of Mixed Reality UX.
The easiest way to develop in Unity is with the Mixed Reality Toolkit. MRTK will help you automatically setup a project for Mixed Reality and provide a set of features to accelerate your development process. By the end of this section, you'll have a basic understanding of the Mixed Reality Toolkit, a properly configured development environment for Mixed Reality apps, and a working MRTK project in Unity that you built yourself.
Checkpoint | Outcome |
---|---|
Introducing the Mixed Reality Toolkit | Begin your journey by getting acquainted with the Mixed Reality Toolkit and what it has to offer |
Download the Mixed Reality Feature Tool | A new developer tool for discovering, updating, and adding Mixed Reality feature packages to your Unity projects |
Setup your developer environment | Download and install the latest Unity package and setup your project for mixed reality |
Complete the HoloLens 2 tutorial series | Dive into beginner level MRTK tutorials for HoloLens 2 hardware |
Important
If you'd like to create a new Unity project without importing Mixed Reality Toolkit, there are a small set of Unity settings you'll need to manually change for Windows Mixed Reality. Take a look at our configuration guide for more information.
Note
Once you've setup MRTK in your project, standard Unity game objects like the camera will light up immediately for a seated-scale experience. You can find instructions on changing the experience scale of your application on the coordinate systems page.
All of the core building blocks for mixed reality applications are exposed in a manner consistent with other Unity APIs. These building blocks are available as standalone features and through the Mixed Reality Toolkit. You might not need all of them at once, but we recommend exploring early on. After diving into the core building blocks listed below, you'll have a toolbox full of features you can integrate into a Mixed Reality project by themselves or through MRTK.
Feature | Capabilities |
---|---|
Camera | Fully optimize visual quality and hologram stability in your Mixed Reality apps |
World locking and spatial anchors | Solve stabilization issues, camera adjustment, and integrate a stable coordinate system solution |
Shared experiences | View and interact collectively with the same hologram at a fixed point in space using spatial anchor sharing |
Gaze | Let users target holograms with by looking at them |
Motion controllers | Add spatial actions to your Mixed Reality apps |
Gestures | Use hand gestures as input in your Mixed Reality experiences |
Hand and eye tracking | Integrate articulated hand and eye tracking input into your user experience |
Spatial mapping | Map your physical space with a virtual mesh overlay to mark the boundaries of your environment |
Spatial sound | Enhance your apps with immersive 3D audio |
Text | Get sharp, high-quality text that has a manageable size and quality rendering |
Voice input | Capture spoken keywords, phrases, and dictation from your users |
Other key features that play a role in mixed reality applications are available through Unity APIs without any extra packages or setup. These features can be added to Unity projects with or without MRTK installed. After diving into the more advanced capabilities that Unity offers, you'll be able to build deeper, complex Mixed Reality apps.
Feature | Capabilities |
---|---|
Photo video camera | Capture photos and video content in your Mixed Reality application |
Focus point | Provide HoloLens a hint about how to best perform stabilization on the holograms currently being displayed |
Tracking loss | Handle scenarios where your device can't locate itself in the applications world space |
Keyboard input | Get input from real-world and Mixed Reality keyboards in your apps |
Once you've got your holographic Unity project ready for testing, your next step is to export and build a Unity Visual Studio solution. With that VS solution in hand, you can run your application in one of three ways on a real or simulated device. By the end of this section, you'll be able to deploy your application on whichever device or emulator fits your development needs.
- HoloLens or Windows Mixed Reality immersive headset
- HoloLens emulator
- Windows Mixed Reality immersive headset simulator
At this point in your development journey you might be looking to add services or for a helping hand with commercial deployment. Integrating Azure Cloud Services can level up your projects in a major way. We've compiled a few starting points for you to explore and expand your Mixed Reality knowledge.
We also have a comprehensive list of support documentation for additional Azure services that you can add to your Unity projects on a self-serve basis.
A developers job is never done, especially when learning a new tool or SDK. The following sections can take you into areas beyond the beginner level material you've already completed, along with helpful resources if you get stuck. Note that these topics and resources aren't in any sequential order, so feel free to jump around and explore!
If you have existing apps that you'd like to port over, the articles listed below are your next stop:
If you're looking to add specific Mixed Reality features to your applications, we have several curated tutorials that can run you through the process from end-to-end. Our most popular HoloLens 2 and HoloLens (1st Gen) content is listed below, but you can find the entire collection by visiting the tutorials overview.
Before going out into the world of mixed reality on your own, we recommend taking a look at the MRTK-related documentation listed below. These articles are great jumping off points for understanding how MRTK works in greater detail and will give you insight into making your app more performant.
Topic | Description |
---|---|
MRTK Architecture overview | Get a deeper understanding of how the MRTK SDK works in your projects |
Settings and performance | Profile your app, update your Unity settings, and get the best hologram stabilization performance available |
Getting started with MRTK + XR | Transfer over to the alternative XR pipeline provided by Unity |
In addition to this documentation, Unity installs documentation for Windows Mixed Reality functionality alongside the Unity Editor. The Unity provided documentation includes two separate sections.
Resource | Description |
---|---|
Scripting reference | This section of the documentation contains details of the scripting API that Unity provides and is accessible online from the Unity Editor by clicking Help > Scripting Reference |
Manual | This manual is designed to help you learn how to use Unity, from basic to advanced techniques, and is accessible online or from the Unity Editor by clicking Help > Manual |
You can find us on the Unity Forums by tagging Microsoft and a combination of the following tags to help us understand what plugin you're providing feedback for:
- HoloLens 2
- Windows Mixed Reality
- OpenXR
- XRSDK
- Legacy XR