Version: 2019.3
Getting started with VR development in Unity
XR API reference

XR Plugin Framework

Unity 2019.3 and newer versions use a new, unified plug-inA set of code created outside of Unity that creates functionality in Unity. There are two kinds of plug-ins you can use in Unity: Managed plug-ins (managed .NET assemblies created with tools like Visual Studio) and Native plug-ins (platform-specific native code libraries). More info
See in Glossary
framework that enables direct integrations for multiple platforms. The tech stack consists of an API that exposes common functionality across the platforms Unity supports and enables XRAn umbrella term encompassing Virtual Reality (VR), Augmented Reality (AR) and Mixed Reality (MR) applications. Devices supporting these forms of interactive applications can be referred to as XR devices. More info
See in Glossary
hardware and software providers to develop their own Unity plug-ins.

This architecture offers the following benefits:

  • Multi-platform developer tools such as ARAugmented Reality (AR) uses computer graphics or video composited on top of a live video feed to augment the view and create interaction with real and virtual objects.
    See in Glossary
    Foundation and the XR Interaction Toolkit
  • Faster partner updates from supported plugins via the Unity Package Manager
  • More platforms have access to an interface to leverage Unity’s XR renderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
    See in Glossary
    optimizations and developer tools

Configuring your Unity Project for XR

To configure your Unity Project for XR, follow these steps:

Open the Project Settings window (menu: Edit > Project Settings), and select XR Plugin Management. Click Install XR Plugin Management if the package hasn't been installed already.

Installing XR Plugin Management
Installing XR Plugin Management

After you install the XR Plugin Management package, you can install XR plug-ins for the platforms you're developing for. Click the Install button next to the plug-in you want to install.

Installing XR platform plug-ins
Installing XR platform plug-ins

Before you can use an installed XR plug-in, you need to load it. After the plug-in installation finishes, click the plus sign in the Plugin Providers list, and select the plug-in.

To configure plug-in specific settings that will affect that platform, navigate to the plug-in's tab under XR Plugin Management.

In this example, the Oculus plug-in has already been installed
In this example, the Oculus plug-in has already been installed

Setting up tracking in the XR plugin framework

Implicit cameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
tracking, which was used in the old built-in system, has been removed in the new XR plugin framework. Implicit tracking worked for simple, HMD-only applications, but wasn’t as intuitive when used in correlation with controllers and other interactions. In the new XR plugin framework, Unity recommends using a hierarchy (TrackedPoseDriver) that makes this transform explicit and user-controllable.

To use the TrackedPoseDriver, you must install the Legacy Input Helpers Package. From the XR Plugin Management window, click Input Helpers, the click the Install Legacy Input Helpers Package button.

Installing the Legacy Input Helpers package
Installing the Legacy Input Helpers package

Next, select XR Tracking to attach a Tracked Pose Driver to Cameras tagged as ‘Main Camera’ in the SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
.

Adding a Tracked Pose Driver to a Camera
Adding a Tracked Pose Driver to a Camera

Keep the Tracked Pose Driver at its default configuration, using the Center Eye as the Pose Source. Leave the Use Relative Transform checkbox clear.

Tracked Pose Driver settings
Tracked Pose Driver settings

Uninstalling XR Plugin Management

To uninstall XR Plugin Management and revert back to the built-in integration system, follow the steps below:

  1. In the Package Manager window (menu: Window > Package Manager), select the XR Plugin Management package from your Project.
    Tip: To filter down to the list of packages currently installed in your Project, click the drop-down at the top of the list and select In Project.
  2. With the XR Plugin Management package selected, click the Remove button.

After the XR Plugin Management package has been removed, the Project SettingsA broad collection of settings which allow you to configure how Physics, Audio, Networking, Graphics, Input and many other areas of your Project behave. More info
See in Glossary
window will revert back to the built-in integration system.

Did you find this page useful? Please give it a rating:

Getting started with VR development in Unity
XR API reference