We are going to setup the environment and run a Demo application for the Oculus Quest 2 with Unity.
# First Step
You need to pair to your smartphone and enable Developer Mode in the Oculus app for the smartphone. Once you have done this you can continue in your computer by installing Unity.
# Unity installation
First install Unity Hub and download Unity (a LTS version if you want)
With the installation complete create a new Unity 3D project.
Now we have an empty 3D project:If you didn't install the needed External Tools as the JDK and SDK, you need to install them from the Unity Hub, just Add Modules to the Unity install, add the Android SDK & NDK Tools, and if you don't have it either, install the Open JDK.Now if you go to the Build Settings, switch to Android and, with your Oculus Quest connected via USB to your computer, make sure that you can see the device in Run Device.
The name of the device should be something like you see here:
# Oculus Tools
We need to download the tools from the Unity Asset Store, they are free. Go to the Asset Store and add to Unity the Oculus Integration.
In the Unity Package Manager, add the Oculus Integration by downloading and Import everything to your project.
# Unity Setup
There are some changes that we need to do in the Unity settings to get the games and the demos to work properly in the Oculus, such as use OpenGLES3 and the installation of the XR Plug-in.
- Using OpenGLES3
In order to Build and Run for the Oculus Quest 2 we need to change the Graphic API, we need to put the OpenGLES3 before Vulkan in the Project Settings/Player/Other Settings:- Install XR Plug-in
Make sure that you have XR Plug-in installed for the Oculus. In the project Settings go to XR Plug-in Manager and install it. Then in the Android tab, check the Oculus: