Notes: Setting up a VR game project

Using Unity version 2021.1.15f1. Create a project with URP template, the performance optimization from URP should be very useful for VR games, especially for standalone VR headsets like Quest 2.

Settings and plugins: Go to Windows > Package Manager > Select Packages: Unity Registry. We’ll need to install two packages:

  • XR Plugin Management
  • OpenXR Plugin. It’ll prompt to use new input system, just follow the instructions given in the dialog.
  • XR Interaction Toolkit. If it’s not shown, go to Edit > Project Settings > Package Manager > Enable Preview Packages. Restart might be needed here. In the same page, expand samples, and then import Default Input Actions.

Next, back to Project Settings, go to XR Plug-in Management, enable OpenXR for the PC tab and Oculus for the Android tab. When OpenXR is enabled, a red exclamation mark should appear, click on it and Fix All. One of that will require you to click on Edit. You’ll be brought to the OpenXR settings page, under the Interaction Profiles, add a preferred Controller Profile (in my case, Oculus Touch)

Default Input System: In the Project directory, Go to Assets > Samples > XR Interaction Toolkit > 1.0.0-pre.4 (or whatever the imported version is) > Default Input Action, select all the presets and add them to default (from the Inspector). Now, go to Edit > Project Settings > Preset Manager, type “Left” and “Right” to the Filter for the ActionBasedController presets respectively. This will automatically assign common inputs to VR actions (like HMD positioning, locomotion, turning, select and activation).

XR Rig: In the Scene hierarchy, right click and add XR > XR Rig (Action based). Select the XR Rig Game Object, add a new component: Input Action Manager. Then add XRI Default Input Action (from XR Interaction Toolkit samples) to the Action assets list.

References: How to Make Oculus Quest 2 Games // Introduction to Unity VR Development by Justin P Barnett https://youtu.be/wnn-dzHz-tA

0 thoughts on “Notes: Setting up a VR game project”

  1. Pingback: Notes: Setting up a game with optional VR – Boon's Devlog and Notes

  2. Pingback: ShurikenVR Devlog#1: – Boon's Devlog and Notes

Leave a Comment

Your email address will not be published. Required fields are marked *