Veggie Saber – Introduction to Unity Development with the Oculus Quest
- Getting Started
- Building Your Virtual Body
- Tracking the Player’s Head Movements
- Setting Up the Right Hand
- Duplicating the Process for the Left Hand
- Positioning Objects Relative to Your Floor
- Grabbing Objects
- Saber Slicing
- Triggering the Slice
- Slicing the Vegetables in Half
- Flattening the Mesh
- Adding Sound Effects to the Slice
- Adding Controller Haptics
- Look Out for Flying Veggies!
- Making the Veggies Move With the Music
- Creating the Veggies
- What Happens When the Player Misses?
- Adding Some Awesome Music
- Updating the Scores
- Deploying on the Oculus Quest
- Enabling Developer Mode via App
- Building the APK Package
- Sideload the App to the Quest
- Install Veggie Saber on the Oculus Quest
- Where to Go From Here?
Deploying on the Oculus Quest
So your VR game works on your PC, but you want to get it onto your untethered VR device. Here are the steps you need to take to deploy your game on the Oculus Quest.
Enabling Developer Mode via App
To create apps for the Oculus Quest, you need to register an account with Oculus, then turn on the developer mode on the Quest as follows:
- Create a developer account and setup an organization to enable developer mode on the device. To do this, visit https://developer.oculus.com/ and create a new account via ‘login’.
- Install the Oculus app for an Android or iPhone to pair with the Quest device.
- From the Oculus app, go to Settings ► Advanced Settings. On this page, enable developer settings.
Building the APK Package
Your next step is to get your APK package up and running. To do it, take the following steps:
- Go to File ► Build Settings.
- Make sure that VeggieSaber is the only scene.
- Select Android as your platform.
- Click Switch Platform to update the project before building.
- Switch Texture Compression to ASTC. ASTC compression is recommended for the Oculus Go and Quest, but ETC2 is another option.
- Select Run Device and change to Oculus Quest.
- Click on Player settings, then go to Settings for Android and set the Splash Image, Virtual Reality Splash Image to RayWenderlichLogo.png to provide a splash screen while loading.
- Under Player settings ► Other settings in Graphics API, remove the Vulcan API and make sure that OpenGLES3 is the first option.
- Find Package Name and set this to com.rw.veggiesaber. This is what the Java package for the program will show when running on the Oculus Quest.
- In the Player Settings, under Other Settings, set the Minimum API Level to Android 6.0 Marshmallow, API Level 23.
- Make sure that Player Settings ► XR Settings still has Virtual Reality Supported enabled and that you’ve included the Virtual Reality SDK (Oculus).
- Under the Oculus entry, enable the setting “V2 Signing(Quest)”, which is needed to create the AndroidManifest.xml correctly to support both Quest controllers. If this setting is missing, make sure that you have switched to the Android build platform and then update the Oculus(Android) package to version 1.38.4 or later by going to Window->Package Manager and downloading the latest Oculus(Android) package.
- Return to the Build Settings, then select Build. When asked, save the build output as VeggieSaber.apk.
Sideload the App to the Quest
Connect the Oculus Quest with the USB-C cable to your computer. If your computer does not have a USB-C port, you’ll need to get a USB-C to USB-A cable.
Download the Android [Platform-Tools] package and unzip it.
Using Terminal (for Mac) or Command Prompt (for Windows), navigate to the opened directory containing the executable ‘adb’ using the following command:
Replace ADB_Directory with the path to your adb folder.
The Android Debug Bridge (adb) provides the way to deploy the built software to the Oculus Quest device. With your Oculus Quest connected, you can now type:
Which should display a message such as ‘1PASXXXXXH9114 unauthorized’. Now, put on the Oculus Quest headset and it will ask whether to trust this computer. Accept and select always allow for this PC.
Now, when you type adb devices, the message will change to:
It’s now ready to accept your deployed software.
Install Veggie Saber on the Oculus Quest
While still in the Console or Command Prompt, enter the following command and press enter:
‘adb.exe install [path to VeggieSaber.apk]‘
When this command completes… congratulations! You’ve installed your first game on the Oculus Quest!
You can start playing by putting on the headset, navigating to Library ► Unknown Sources and selecting com.rw.veggiesaber to launch the app.
Where to Go From Here?
If you’d like to know more about developing experiences for VR using the latest in Unity features and tools, here are some links:
- Oculus Integration for Unity provides the Oculus OVRPlugin and scripts for controller and headset input, and helper utilities such as setting the floor height. Get more details here: Oculus Integration.
- Learn more about building custom effects with the Shader Graph and Lightweight Rendering Pipeline: Unity Shader graph.
- Learn about optimizing for VR experiences with Unity VR and AR by Tutorials.
Thanks for reading through this tutorial. If you have any questions or comments, feel free to ask in the forums or to leave a comment below!