Loading lessons...
XR Architecture & Input
XR Architecture & Input
XR (Extended Reality) is the umbrella term covering Virtual Reality (VR), Augmented Reality (AR), and Mixed Reality (MR). Unity uses a modular architecture to support diverse headset hardware.
XR Plugin Management
Instead of importing individual SDKs for each brand of headset, Unity uses XR Plugin Management:
- Open Edit -> Project Settings -> XR Plugin Management.
- Install the plugin manager.
- Check the loader box for your target hardware (e.g. OpenXR for most VR headsets, Oculus for Meta Quest, or Apple visionOS).
This ensures your game code calls a unified rendering API, while the plugin handles the translations for the hardware.
OpenXR Standard
OpenXR is a royalty-free open standard created by Khronos Group. It allows developers to build cross-platform VR/AR applications that run on compatible hardware without recompiling code for each headset brand.
XR Origin (The Camera Rig)
In standard games, you place a camera. In VR, you need an XR Origin GameObject:
- Camera Offset: Positions the virtual camera to match the player's physical height.
- Main Camera: Tracks the headset position and rotation.
- Left/Right Hand Controllers: Tracks the physical motion controllers in 3D space, updating their positions and rotation offsets automatically.
TL;DR
- XR covers Virtual, Augmented, and Mixed reality environments.
- XR Plugin Management loads hardware runtimes (OpenXR, Oculus, ARKit).
- OpenXR is the standard API for cross-platform hardware compatibility.
- XR Origin acts as the coordinate rig for cameras and controllers.