Introducing the Unity XR platform
Unity's XR platform aims to provide the tools necessary to achieve the core principle of the Unity engine – "Build once, deploy anywhere" – for VR and AR projects so that you can target any number of different platforms and devices with a single version of your content. In the past, VR developers have been plagued by incompatible device-specific, vendor-specific, platform-specific SDKs and toolkits. Various other "solutions," both open source and proprietary, have had serious shortcomings and limited support. The XR platform architecture has a technology stack that enables direct integrations of multi-platform deep integration, new features, and optimization. The XR tech stack is shown in the following diagram, which has been taken from the Unity Manual's XR Plug-in Framework page (https://docs.unity3d.com/Manual/XRPluginArchitecture.html):
At the bottom of the stack are device-specific XR plugins. Some are provided and directly supported by Unity. Others are provided and supported by third-party developers for their own devices. This XR plugin architecture itself is a very important design as it decouples device-specific updates from the core Unity release cycle, as well as allows device providers to independently add and update their own device support in Unity (using the Unity XR SDK).
Using these provider plugins, the XR subsystems deliver core capabilities in a modular design, organized and separated by feature category. This allows developers to choose which XR features they want to build into a project and allows Unity to update individual subsystem modules independently. As a developer, you can use these subsystem components and C# classes directly in your projects, keeping the project content relatively device-independent. This way, you can focus on your own project's features instead of fighting differences between specific device APIs.
On top of the XR plugin framework, Unity offers two toolkits. AR Foundation is for augmented reality projects and won't be considered in this book. The XR Interaction (XRI) Toolkit is for both VR and AR, and we are going to use it extensively in the projects in this book. As we'll see, XRI provides components for tracking camera rigs and hand controllers, as well as for interaction with objects in the scene such as grabbing and throwing, teleportation, and other interactions common in virtual reality.
To get started with your Unity project ready for VR, you should identify the VR platform(s) and device(s) you initially plan to target.