Build Apps in Unity

All-In-One VR

This section describes how to configure build settings in Unity. The build workflow mainly comprises selecting the build platform such as Android or Windows, adding scenes, configuring VR support, and building the app. In addition, you can configure quality and rendering settings to optimize the build time and app performance.

Select Build Platform

Build settings let you set the target platform, configure build-related settings, and start the build process. We recommend that you set the app’s target platform, such as Windows or Android, prior to performing any other project settings as there are a variety of settings that depend on it.

The target platform for Oculus devices that run on Windows, such as Oculus Rift and Oculus Rift S, is PC, Mac & Linux Standalone, and builds a .exe file.

  1. In the menu, go to File, and select Build Settings.
  2. Under Platform, select PC, Mac & Linux Standalone. By default, Windows is set as the target platform.
  3. In Target Platform, select Windows.
  4. Clear the Development Build selection for the final build as it may impact performance.
  5. Click Switch Platform, if the target platform was different than PC, Mac & Linux Standalone.

The target platform for Oculus devices such as Oculus Quest that run Android is Android and builds an .apk file.

  1. In the menu, go to File and select Build Settings.
  2. Under Platform, select Android.
  3. Set Texture Compression to ASTC.
  4. In Run Device, select the Oculus device to run the app in the Oculus device. Your device is listed only if it is connected to your computer over USB. This is an optional step and is usually helpful to test the app on a real device.
  5. Clear the Development Build selection for the final build as it may impact performance.
  6. Click Switch Platform.

Add Scenes

The Scenes In Build pane displays a list of scenes from your project that Unity includes in the build.

  1. In Scenes In Build pane, click Add Open Scenes. Alternatively, you can drag scenes from the Assets folder into this window.
  2. Clear the scene selection for the ones you want to exclude from the build. This excludes the scene from the build and not from the list.
  3. To adjust the order of the scenes, drag them up or down the list. Numbers on the right indicates the scene index, which is mostly used in scripting APIs.

Configure VR Support, Package Details, Quality, and Rendering Settings

Prior to building your app, there are a variety of additional settings you should consider. These settings define VR support, add package details to uniquely identify your app in the Oculus store, and optimize app performance. If you’ve followed instructions outlined in Configure Settings, you can skip this step.

  • Perform quality settings to define graphical quality such as texture quality, pixel light count, or anti-aliasing level.
  • Perform rendering settings to select a specfic set of Graphics APIs, choose color space property, or enable multithreaded rendering.

Strip Unused Shaders

Before you generate the final build, we highly recommend that you strip unused shaders, which significantly reduces the build time.

Generate Build

To generate the final build, also known as Player, you’ve two options:

  • To build your app into Player, click Build and provide location to save your build. This option builds the ready-to-upload executable. It does not automatically deploy or run your app on the Oculus device.
  • To build your app into Player and run it on the Oculus device, click Build and Run and provide location to save your build.

The Build and Run option requires you to connect the Oculus device to your computer over a USB-C cable. As mentioned in step 4 of Select Build Platform, select the device from the Run Device list. If your device is not connected or has connection or detection issues, the Build and Run option fails in generating build.

Build for Testing and Debugging

Before you are ready for the final build, your app undergoes many changes, which often require you to build the app for testing purposes. In general, Unity’s build options are time consuming as it compiles the entire project instead of using delta.

If your purpose of building app is to test changes, we highly recommend that you use OVR Build APK and Run and OVR Quick Scene Preview. These tools are specifically designed for Android apps and significantly expedites build iterations. When you’re ready for your final build, you can then use Unity’s Build or Build and Run option.

To run your app that is pending Oculus review, the Oculus device must allow apps from unknown sources.

  1. Open the Oculus companion app.
  2. From the upper-right corner, click the gear icon.
  3. Go to Settings > General > slide the toggle to allow unknown sources. When prompted for confirmation, select Allow.
  4. Go to the location where you’ve saved the build and launch the executable.
Oculus Companion App Settings, section to allow for unknown sources highlighted