Unity XR Plugin Framework Overview + Set Up
by Jennifer Wang (2022)
XR Plug-in Framework
Unity 2019.3 and newer versions use a new, unified plug-in 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 XR hardware and software providers to develop their own Unity plug-ins.
Set Up in 2020.3
First, open an existent Unity Project or create a new one (It can be a Unity3D project, VR starters project, etc.).
Before you can begin developing for a particular device, you need to make sure we can interface with different devices.
To enable XR plugins:
From the top menu select Edit > Project Settings.
In the XR Plugin Management panel, click the Install XR Plugin Management button.
To allow the installation of “Preview” packages:
In the Project Settings window, in the Package Manager panel, select the option to Enable Preview Packages and click “I Understand”.
To browse preview packages in the Package Manager:
From the top menu, select Window > Package Manager.
To be able to search through all packages, from the drop-down in the top-left, change the scope from “In Project” to “Unity Registry”.
You should now have the appropriate plugins installed for your target device. It would technically be possible to deploy to a device now if we already had a functioning project, but in order to actually develop the project, we need to install the XR Interaction Toolkit (XRIT).
To install the XR Interaction Toolkit package:
Open the Package Manager window.
Search for and select the XR Interaction Toolkit package.
Click Install. This will allow you to quickly develop XR interactions.
To install helpful samples for quick development:
With the XR Interaction Toolkit package selected in the Package Manager, a new Samples fold-out appears at the bottom of its description.
Click to Import the Default Input Actions.
This provides presets for mapping specific buttons to actions using the action-based input system
Click to Import the XR Device Simulator
This allows you to test your VR app using keyboard and mouse controls rather than an actual headset.
Ensure that the following packages are installed into your project
From the top menu, select Window > Package Manager.
In the left panel of the Package Manager, locate the following packages
XR Plugin Management
XR Interaction Toolkit
OpenXR Plugin
Universal RP (Render Pipeline)
5. Add XR Origin
Open the dropdown menu by clicking the plus sign, hover over XR, and choose XR Origin (Action-based)
6. Add XR Interaction Manager
Open dropdown menu from plus sign, hover over XR, and select XR Origin (Action-based)