In this section of the guide, we show you how to port an application or game to native Unity VR. This is a multi-stage process. Follow these steps:
- Install a recent version of Unity. The most up to date version is best; Unity 5.1 is required for native VR support; 2018.3 adds significant support including when targeting multiple VR platforms.
- Install the appropriate SDK for each device that you would like to be supported. Devices may also need a signature file that you can download from the relevant website. Place the signature file in the required folder on your device.
For example, the Samsung Gear VR that runs the Ice Cave demo needs a signature file from the Oculus developer website. The signature file for a Samsung device must go in the Plugins/Android/assets folder. Configure the relevant Oculus SDK. Use SDK Suite 1.41 or earlier - Gear support has ended in the most recent Oculus SDK.
Note: From Unity 2018 onwards, you could use the Experimental VR Lightweight Render Pipeline, but more recent versions want the Universal Render Pipeline.
- Enable Virtual Reality support in Edit > Project Settings > Player > XR Settings.
Note:Currently Unity does not support Vulkan with VR, so set your Graphics API to OpenGL ES3.
The following screenshot shows the Player Settings window:
- Set up the camera. Most VR systems have a Prefab set up that you need to add. You also need to remove the default Main Camera.
- Enable the Developer options menu for Android devices and turn on USB debugging. The following screenshot shows the Developer options menu:
- Build the application, connect the device, and choose to run on the device in Unity.
- Launch the application.
Enable Samsung Gear VR developer mode
When you launch the application on a Samsung device, it prompts you to insert the device into the headset. If the device is not ready for VR, it prompts you to connect to the network to download the Samsung VR software. Samsung Gear VR developer mode can help you to visualize the VR application that is running, without inserting the device into the VR headset.
Samsung Gear VR Developer mode can be enabled if you have already installed a signed VR application. If you have not installed a signed VR application, install a signed VR application so that you can enable this mode. To enable developer mode:
- On the Samsung device, select Settings > Application Manager > Gear VR Service.
- Select Manage Storage.
- Tap on the VR service version six times.
- Wait for the scan process to complete. A developer mode toggle appears.
Note: Using developer mode reduces the battery life of the phone. This is because it overrides all the settings that turn off the headset when it is not in use.
The following figure shows an example Ice Cave screenshot from the Samsung Gear VR developer mode view: