🚀 Try Zilliz Cloud, the fully managed Milvus, for free—experience 10x faster performance! Try Now>>

Milvus
Zilliz

How do you set up a basic VR project in Unity?

To set up a basic VR project in Unity, start by installing the Unity Hub and creating a new 3D project. Ensure you’re using a version of Unity that supports XR development, such as 2021 LTS or newer. Open the Package Manager (Window > Package Manager) and install the XR Plugin Management package. This package provides the foundation for integrating VR hardware. Next, install platform-specific plugins like Oculus XR Plugin for Meta Quest or OpenXR Plugin for broader compatibility. Enable these plugins in Project Settings under XR Plug-in Management, then check the boxes for your target platforms (e.g., Android for Quest or PC for SteamVR headsets).

After configuring the plugins, set up the VR camera rig. In the Hierarchy panel, delete the default Main Camera and add an XR Origin (VR) object via GameObject > XR > XR Origin (VR). This prefab includes a camera offset and controllers. If using the XR Interaction Toolkit, import it via the Package Manager and add components like XR Ray Interactor to the controllers for basic interaction. Create a simple environment by adding a Plane (as a floor) and a Cube (as a test object). Adjust the XR Origin’s height to match real-world eye level (e.g., 1.6 meters on the Y-axis) to ensure the camera starts at a natural position.

Finally, configure input and test the project. Assign input actions using the Input Action Manager and link controller bindings (e.g., grip, trigger) to interactions like grabbing objects. For testing, connect your VR headset to your PC or build directly to the device. In Build Settings (File > Build Settings), switch the platform to Android for Quest or standalone PC for headsets like Valve Index. Enable developer mode on the headset if required. Test basic interactions, such as moving the Cube using the XR Grab Interactable component. Optimize performance by enabling single-pass rendering (URP or HDRP) and adjusting quality settings. This setup provides a functional foundation for expanding VR features like locomotion or UI interactions.

Like the article? Spread the word