Unity introduced a new unified XR plugin framework at the end of 2019 with the release of Unity version 2019.3. Moving forward, this is the Unity-recommended solution for partners that use VR, AR, or MR to enable all XR functions on their devices.
As the previous implementation of VR integration will be deprecated in future, it is highly recommended to migrate your application to this new XR plugin framework. Varjo and other XR partners will be able to deploy updates to the platform layer via the Unity Package Manager.
You can learn more about this change in the Unity XR SDK documentation: XR Plug-in Framework.
Note: Only the High Definition Render Pipeline (HDRP) is supported at this point. The Universal Rendering Pipeline (URP) is currently limited in XR support due to a Unity-related bug. This will be addressed in a future release of the XR Plugin.
Adding Varjo XR support to a Unity project
Open an existing HDRP Unity project or create a new one using the High Definition RP project template.
In the Unity toolbar, select Window -> Package Manager.
Click the + icon in the top left corner. Select Add Package from git URL and enter the URL for the Varjo XR plugin repository:
In the Project Settings dialog, select the XR Plugin Management tab and select the checkbox for Varjo in the Plug-in Providers list.
The Varjo XR plugin is now enabled in your project. You can modify the plugin settings in the Project Settings dialog under the XR Plug-in Management tab and Varjo.
To enable HMD tracking for the camera, select the Main Camera of the scene and add the Tracked Pose Driver component. Make sure the Device dropdown in the component is set to Generic XR Device and Pose Source is set to Center Eye – HMD Reference. The Main Camera will now follow the HMD position and rotation.
Additional Unity XR-related configuration options can be found in the official Unity documentation: Configuring your Unity Project for XR.