VR in Unity: Pt 01- VR Dev Series 01
Objective: create a VR developing environment in Unity for Oculus Quest 2
Virtual reality is a huge trend in decades. Regardless of gaming or implement in life, VR is quite potential in many fields.
For all the VR devices, Oculus Quest 2 is the most well-known and most popular one. It has a standalone system which based on an Android core, and can be played without any cable plugged in.
I myself own a HTC Vive few years ago, which would rely on a high quality computer to run the VR games. When I noticed the Oculus Quest 2, I got attracted by its convenience.
In these series of articles, we will create and build some VR function that would runs on Oculus Quest 2, as the first step into the VR world.
In this tutorial, we will create the project of VR in Unity, which would require some basic setting in it.
- Unity version of 2021.1.17 or higher, with Android modular installed.
- A Oculus Quest 2 device
- A cable to connect PC and OQ2
- Oculus software installed on PC
First, let’s create a 3D project in Unity with 2021.1.17f1.
Notice that although there is a VR template, I would suggest using the basic 3D to get a fully control of our project.
With editor opened, open Edit> Project Setting> XR Plug-in Management, and select install.
Once done, there should have multiple options to select on both PC and Android tab.
For PC, I would select Open XR, which is a multiplatform developing method that would let you not only create a VR program for OQ2, but also for other compatibility devices.
When clicked Open XR, it should runs some necessary settings, and it might need to restart the editor.
After restarted, it should be finished installing the function of Open XR. Now you would notice that there is a warning sign next to it.
Click the warning sign and it should pop up a window.
Normally, you can click Fix All at the above to solve everything at one time. However, in here you should select the controller you would use to fix the problem.
Select Edit from the first warning.
And click the plus button at the column of Interaction Profiles.
Now you can add multiple controller profile to your project. In here, I would add Oculus Touch Controller Profile.
Once done, the warning sign of Open XR should be gone.
And for the Android tab, you can simply select Oculus.
Now we would need to install some packages.
Before open the Package Manager, we need to go to Project Settings> Package Manager, and click Enable Pre-release Packages.
Then select Window> Package Manager, and install these packages from Unity Registry:
- Input System
- OpenXR Plugin
- XR Interaction Toolkit
With these installed, we will be ready to get our vision into VR.
Which will be in the next tutorial.
— — — —
XR Interaction Toolkit had been removed from editor version 2021.2. Here is how to add this package when you could not find it in Package Manager.
Following the guide from official website, you should add this package by its name.
Copy the name of package.
Open Package Manager and click the add button on the top left.
Select Add package by name.
Paste the name on it, and the version is optional.
Then you should be able to install the package.