- Hololens 2 Unity Tutorial
- Hololens Visual Studio Unity
- Deploy From Unity To Hololens
- Unity Hololens App
What is Mixed Reality Toolkit (MRTK)?
MRTK is an amazing open-source toolkit that has been around since the HoloLens was first released. The toolkit wouldn't be where it is today without the hard work of our contributing developer community. Over the past three years, we've listened to the feedback of our developer community, and built MRTK v2 to take the biggest concerns into account.
MRTK for Unity is an open-source, cross-platform development kit for mixed reality applications. The toolkit provides a cross-platform input system, foundational components, and common building blocks for spatial interactions. MRTK version 2 intends to speed up application development for Microsoft HoloLens, Windows Mixed Reality immersive (VR) headsets, and OpenVR platform. The project is aimed at reducing barriers to entry, creating mixed reality applications, and contributing back to the community as we all grow.
Intro to Building Apps for HoloLens 2 Using Unity and Mixed Reality Toolkit - BRK1003 - Duration: 55:53. Microsoft Developer 10,121 views. MRTK-Unity supports Ultraleap hand tracking, leveraging our SDK and Unity modules. This means cross-platform applications developed with MRTK can work not only on Hololens 2 but on other head-mounted devices with Ultraleap hand tracking. Not only have they developed the best-selling mixed reality products (Hololens) available today, but they have also created a first-rate mixed reality toolkit for creating mixed reality software on the Unity platform. This toolkit, often shortened to MRTK is the focus of our article because it can provide such a big boost in mixed reality development, and we will explain why.
Take a look at the MRTK's documentation on GitHub and get started with the installation guide.
New with MRTK v2
We want to stress our commitment to these platform tools. In fact, we used MRTK version 2 to develop our inbox experiences, such as the out-of-box setup experience (OOBE) and our Mixed Reality Tips application. You can also expect to see new HoloLens 2 capabilities first exposed through MRTK because we believe it’s the best way to develop on our platform.
Modular
We have built it in a modular way, so you don't need to take every bit of the toolkit into your project. There are actually a few benefits to this. It keeps your project size smaller, and makes it easier to manage. Additionally, because it’s built with scriptable objects and is interface-driven, it’s also possible for you to replace the components that are included with your own, to support other services, systems, and platforms.
Cross-platform
Speaking of other platforms, it has cross-platform support. And while this doesn’t mean every single platform is supported, we have made sure none of the toolkit code will break when you switch your build target to other platforms. The robustness and extensibility of the modular design sets your apps up to support multiple platforms, such as ARCore, ARKit, and OpenVR.
Performant
Working with mobile platforms, we constructed it with performance in mind. This is super important, and we wanted to ensure that the tools aren't going to work against you.
See also
To run an app on device as a standalone app (for HoloLens, Android, iOS, etc.), the build and deploy step needs to be executed in the unity project. Building and deploying an app that uses MRTK is just like building and deploying any other Unity app. There are no MRTK-specific instructions. Read below for detailed steps on how to build and deploy a Unity app for HoloLens. Learn more about building for other platforms at Publishing Builds.
Building and deploying MRTK to HoloLens 1 and HoloLens 2 (UWP)
Instructions on how to build and deploy for HoloLens 1 and HoloLens 2 (UWP) can be found at building your application to device.
Tip: When building for WMR, HoloLens 1, or HoloLens 2, it is recommended that the build settings 'Target SDK Version'and 'Minimum Platform Version' look like they do in the picture below:
Hololens 2 Unity Tutorial
The other settings can be different (for example, Build Configuration/Architecture/Build Type and others can alwaysbe changed inside the Visual Studio solution).
Make sure that the 'Target SDK Version' dropdown includes the option '10.0.18362.0' - if this is missing,the latest Windows SDK needs to be installed.
Unity 2019.3 and HoloLens
If a HoloLens app appears as a 2D panel on device, make sure the following settings have been configured in Unity 2019.3.x before deploying your UWP app:
If using the legacy XR:
- Navigate to Edit > Project Settings, Player
- Under XR Settings in the UWP tab, make sure Virtual Reality Supported is enabled and the Windows Mixed Reality SDK has been added to SDKs.
- Build and deploy in Visual Studio
If using the XR-Plugin:
- Follow the steps found in Getting Started with XRSDK
- Make sure the configuration profile is the DefaultXRSDKConfigurationProfile
- Navigate to Edit > Project Settings, XR-Plugin Management and make sure Windows Mixed Reality is enabled.
- Build and deploy in Visual Studio
Important
Hololens Visual Studio Unity
If using Unity 2019.3.x, select ARM64 and not ARM as the build architecture in Visual Studio. With the default Unity settings in Unity 2019.3.x, a Unity app will not deploy to a HoloLens if ARM is selected due to a Unity bug. This can be tracked on Unity's issue tracker.
If the ARM architecture is required, navigate to Edit > Project Settings, Player, and under the Other Settings menu disable Graphics Jobs. Disabling Graphics Jobs will allow the app to deploy using the ARM build architecture for Unity 2019.3.x, but ARM64 is recommended.
Building and deploying MRTK to a Windows Mixed Reality Headset
Deploy From Unity To Hololens
The Windows Mixed Reality (WMR) headset can be used for Universal Windows Platform (UWP) and Standalone builds. A Standalone build for a WMR headset requires the following extra steps:
Note
Unity's XR SDK also supports native WMR in Standalone builds, but does not require SteamVR or WMR plugin. These steps are required for Unity's legacy XR.
- Install Steam
- Install SteamVR
- Install the WMR Plugin
How to use WMR plugin
Open Steam and search for the Windows Mixed Reality Plugin
- Make sure SteamVR is closed before launching the WMR Plugin. Launching the WMR plugin also launches SteamVR.
- Make sure the WMR headset is plugged in.
Select Launch for the Windows Mixed Reality for SteamVR Plugin.
SteamVR and the WMR plugin will launch and a new tracking status window for the WMR headset will appear.
For more information visit the Windows Mixed Reality Steam Documentation
In Unity, with your MRTK scene open, navigate to File > Build Settings
Build the scene
- Select Add Open Scene
- Make sure the Platform is Standalone
- Select Build
- Choose the location for the new build in File Explorer
A new Unity executable will be created, to launch your app select the Unity executable in File Explorer.
Unity Hololens App
See also
