VR Template Quick Start Guide
Unity’s VR Project Template provides a starting point for virtual reality development in Unity. The template configures project settings, pre-installs the right packages, and includes various pre-configured Example Assets to demonstrate how to set up a project that is ready for VR. Please refer to the XR Project Setup documentation for additional information.
The VR Template uses the following Unity features:
- XRI Toolkit v2.3.2 - A high-level, component-based, interaction system for creating XR experiences. It provides a framework that makes 3D and UI interactions available from Unity input events.
Using the Sample Scene
The VR Template contains a Scene named SampleScene
located in Assets/Scenes
. This scene’s Hierarchy is pre-configured with GameObjects that allow your application to manage controller and head tracking, locomotion, and interaction with spatial UI and virtual objects.
You can use this scene as a reference, or you can remove the example Assets from it and use it as a starting point for your own Project.
Sample Scene Hierarchy Overview
Interactables
There are various objects within the scene that the user is able to interact with. In XRI, they are called interactables. The grab interactable allows a user to pick up a GameObject using either a direct or ray interactor. Grab interactables need a Rigidbody and a Collider to define the interactable area.
In addition, the Affordance system provides feedback for the user with visual and auditory cues. This requires the use of the XR Interactable Affordance State Provider with a specified interactable source. For the interactables included in the Sample scene, there is an Audio Affordance Receiver and a Color Affordance Receiver already set up.
Color Affordance Receiver Example
Audio Affordance Receiver Example
These Affordance Receivers are driven by Affordance System Themes found in Assets > VR Template Assets > Themes.
Edge Color Affordance Theme Example
Audio Affordance Theme Example
Teleportation
Teleportation allows users to move within the Sample Scene without experiencing the discomfort common while walking in VR. Teleportation Areas designate specific surfaces for the user to move. The teleportation area is configured with specific colliders from the scene.
Teleportation Area
Teleport Anchors, on the other hand, constrain the user’s view in terms of position and rotation while teleporting. One is already set up for you in the scene.
Teleportation Anchor
Spatial UI
The Sample Scene contains various world space UI examples which allows both near and far interactions with UI elements such as sliders, dropdown menus, toggles, and buttons. In addition, user’s have the ability to move the canvas in space with the Spatial UI Panel prefab, which affords the ability to grab the canvas by either the header or handle at the bottom of the canvas. Billboarding with the Turn To Face component is on the prefab by default, with the positional transformation of the canvas being determined by the direct/ray interactor.
Spatial UI Example
Project Configuration
Various presets are used to accommodate graphics & rendering requirements for different platforms. By selecting the target platform in the Build Settings, i.e. Windows, Mac, Linux or Android, different URP Config Settings are automatically updated for the user. The presets can be found in Assets/Settings/Project Configuration
.
For Android, the Android Preset
and Performance URP Config
assets provide a good baseline of graphics settings for low powered headsets such as the Quest.
For standalone PC VR, the Standalone Preset
and Quality URP Config
assets allow for a higher quality experience.
In addition, by selecting the target platform in Build Settings, OpenXR feature groups and interaction profiles are preconfigured. By default, the Android build target updates the settings for Meta Quest support.
For standalone PC VR, numerous interaction profiles are already configured for the user. If you don't see your platform listed, add your interaction profile manually by clicking the + button.