Updated on
March 21, 2023
In this VR Builder tutorial, you will learn how to set up VR Builder for running VR applications standalone on Oculus Quest devices. To build the VR app in Unity, we will go through the following steps.
To follow this tutorial, you will need a compatible Unity version with Android support and an Oculus Quest device with Developer Mode enabled. First, we need to set up our VR Builder environment to work with Oculus. This can be comfortably done through VR Builder's Setup Wizard. Proceed through the wizard until you reach the VR Hardware Setup page, then select Oculus Quest/Rift and proceed.
This will install the required packages to work with standalone VR. Note that VR Builder will not install the Oculus Integration Asset Store package. You can add the Oculus Integration manually if you need its functionality. Additional information on how to set up VR Builder you can find in our setup guide tutorial.
By default, VR Builder sets up the project for desktop use. To make it work on standalone, you’ll need to add Oculus for Android to the list of initialized XR Plug-ins. Therefore, open the Project Settings and select the XR Plug-in Management entry. There, Oculus should be selected in the list of desktop plug-ins. Switch to the Android tab, and check the Oculus box to enable the plug-in.
You can also configure more Oculus-specific options in the Oculus subsection of the XR Plug-in Management, but the defaults should be fine.
Once the required packages are installed, we need to switch the build target to Android. This means that the final app will be an APK file for Android devices, like Oculus Quest instead of a Windows EXE file. To do so, go to File > Build settings…. The active build platform is highlighted by a Unity icon in the list to the left. The currently selected platform should be PC, Mac & Linux Standalone. Select Android instead and click Switch Platform. This could take some time depending on the project’s contents.
It is advisable to review the project settings, especially the Player section, to configure the app as desired. However, no manual changes are really needed - the required values will be set automatically. Specifically, Oculus requires at least the Android API level 23, which will be changed automatically once Android is selected as a build platform. Also, some features require .NET 4.x support. It can be selected now, or you will be prompted to switch when attempting a build.
Next, review the Player settings, where some options should be changed. Oculus requires at least the Android API level 23, which will be changed automatically once Android is selected as a build platform. Also, some features require .NET 4.x support. It can be selected now, or you will be prompted to switch when attempting a build.
The project will build and work just with these settings, but for better performance it’s recommended to change the Scripting Backend from Mono to IL2CPP, then deselect ARMv7 and select ARM64 as target architecture.
If you have issues building, you can try setting Managed Stripping Level to Low instead of Minimal.
It should now be possible to build standalone apps on the Quest. However, a central VR Builder feature requires a bit more attention: the text-to-speech engine. As VR Builder uses the Microsoft text-to-speech engine by default, it will not work natively on Android devices. It is therefore necessary to pre-cache the audio files on the building Windows PC, so that the headset only needs to playback the files.
First, we need to enable the option to pre-cache the files in Project Settings > VR Builder > Language. There, check the option Save Audio Files to StreamingAssets.
Then, the process needs to run once on the development machine in order for the files to be created. Try, for example, opening the Demo Scene (Tools > VR Builder > Demo Scenes > Core) and pressing Play. There’s no need to plug in a headset or go through the entire VR Builder process. Once the process has started, play mode can just be stopped immediately. The cached files can be found in the StreamingAssets folder. Here we can see that a TextToSpeech folder has been created. It contains a number of WAV files with the spoken instructions.
For more information on the text-to-speech engine, you can check our tutorial on verbal instructions in VR. It is now possible to build VR apps on Oculus Quest devices.
Now it’s time to build and run the project on the Oculus Quest. First, connect your Oculus Quest device to the PC with a USB cable. The device must have developer mode enabled. You will be prompted to Allow USB debugging and Allow access to data in the headset, and need to give both permissions.
Then, re-open the File > Build Settings… window and select the connected Oculus Quest device as your run device. In my case, it is an Oculus Quest 2.
You should also ensure to add the desired scenes to the list of built scenes at the top of the window. Finally, press Build and Run to run the app on the Oculus Quest device. Once the build is complete, it will start automatically once the headset wakes up.
In this VR Builder tutorial, you learned how to set up VR Builder for running VR applications standalone on Oculus Quest devices. This means that you are now ready to build and run your VR apps in Unity. Kickstart your VR development in Unity with our tutorial on the VR Builder Process Editor.