Start Developing for Meta Quest in Unity with This 10-step Setup
Sarah Rowe
In this tutorial, we’ll demonstrate how to setup your Oculus Quest with Unity for development: from putting your device into developer mode, to setting up your Quest controllers.
We’ll be developing our Oculus Quest in OpenVR because of its cross-platform
capabilities.
Hot to Enable Developer Mode on your Quest 2
First up, you’ll have to download the Oculus app onto your phone. You’ll be able to manage all Oculus devices through this app.
Once the app is installed, turn on your Quest. In your Oculus
app, select “Settings” in the lower right corner.
Select your Oculus Quest from the list. If it isn’t appearing, try restarting your Quest.
In the menu that appears when you select your Quest, select “Other Settings.” Click the slider to activate Developer Mode.
At this point you’ll be prompted to register for a developer certificate
with Oculus. If you already have one, you can move to the next step!
Install Android Tools
You’ll be using Android SDK and related tools in Unity, so we’ll have to make sure you have these plugins installed.
Download
Android Studio
from their website. Open Android Studio, go to your top menu to access
“File,” then “Settings” to open your SDK Manager.
Download and install:
- Android 4.4 (SDK19)
- Android 7.1 (SDK 25)
- SDK Tools (In the “Android SDK Tools” tab)
- SDK - Platform Tools
Install and run Unity
If you haven’t installed Unity yet, let’s get that process started. It’s free and available on Unity’s website here.
When installing Unity, make sure you install the Android Build
Support with it.
To develop for Oculus Quest, you’ll want the 2017.4 version of
Unity or higher.
Create a New Unity Project
Let’s open up Unity and create a new project. Name it something unique that you’ll remember. Change your Template to “3D”. Lastly choose the folder location where you’d like to save this project.
Download and Import Oculus Plugin
Oculus tries what it can to make building for its devices easy on the developers. The Oculus plugin is compatible for the Quest and all other Oculus devices. Plus it’s free, bonus!
To download and/or import the plugin, go to Unity’s Asset
Store along the finder bar at the top of your screen. Once the Asset Store
window opens, search for “Oculus Integration.” Download this plugin, or
import it into your project if you already have it downloaded.
Your Unity project may ask if you want to update the Oculus Plugin Utilities. Select “Yes” and “Restart”. Sit back and relax while your computer does its thing.
Install OpenVR and XR Legacy Input Packages
Head back up to your finder bar at the top of the screen and mouse over “Window” then click on “Package Manager” and select the tab “All.” This is a long list of available packages to install in your project. The two we’re looking for are “Open VR” and “XR Legacy Input Handlers.” Select them to install, and close the Package Manager.
Note that “XR Legacy Input Handlers” may not be listed if
you’re using an older version of Unity. If this is the case, the Input
Handlers are automatically installed.
Set Your Project's Build Settings
You’re doing great! We’ve downloaded and installed all the tools you need to develop for Oculus Quest. Now we need to make sure they’re configured to work with your project.
In Unity, go to your top menu, hover over File, and click on “Build Settings…”
The Build Settings window appears. If there are any settings listed in the “Scenes in Build” area, select them and delete them. We want to start from scratch.
Click on the “Add Open Scenes” button and add the scene you currently have open. This may take a minute or two.
In the Platform menu within “Build Settings” click on “Android” and select “Switch Platform.” While doing this, make sure your Texture Compression is set to “ASTC.”
Next, Click on “Player Settings” on the lower left-hand side
of the window. This opens another window on the far right off the screen. In
“Player Settings,” you’ll want to change:
- Company Name
- Product Name
Scroll down and unfold the “Other Settings” section. In the
“Identification” section, change Minimum API Level to 4.4 KitKat. Confirm
your Package Name is along the lines of “com.company name.product name”
Scroll down and unfold the “XR Settings” section. Confirm that
“Virtual Reality Supported” is checked.
Lastly, in the “Virtual Reality SDKs” section, click on the
little “+” and select “Oculus.” Then click “Build” on the bottom right-hand
side of your Build Settings window. You’re now ready to start building!
Note: Some users get an error at this point. If this is the case for you, go back into “Other Settings” and into the “Graphics API” list. Remove “Vulcan” and your error should be resolved.
Setup Your Quest Controllers
We’re going to set up a couple of spheres to represent your controllers ingame. You can download any asset from Unity’s Asset Store to represent your controllers and hands, but for simplicity in this tutorial we’ll be using spheres.
Head over to your Hierarchy on the left hand side. Right-click to add a GameObject, and let’s add a sphere.
On the right hand side is your Inspector. When selecting your new Sphere, head to the Inspector and set the scale of your sphere to 0.1 in X, Y, and Z fields (this is 0.1 meter).
Right-click in the Inspector to add a Tracked Pose Driver component to the sphere. (This is why we needed the XR Legacy Input Handler package). In this component, set your “device” to Generic XR Controller.
Add another component, this time a Rigid Body Component to your sphere. Enable the “isKinematic” property, and disable “Use Gravity.”
Duplicate this sphere and change your “Pose Source” in the Tracked Pose Driver to “Right Controller”. Double check that the other sphere’s “Pose Source” is set to “Left Controller.”
Next, set the position of your Main Camera and spheres to 0,
0, 0 in the Inspector. Great!
Set Up Your VR Scene
Let’s add a Cube to the scene so we have something to see and interact with while in game.
Right-click in the Hierarchy tab to create a new GameObject and select a Cube.
Set the position of the Cube to 0, 0, 1 so it will appear 1 meter in front of you.
In the Cube’s Inspector tab, add a RigidBody component, and make sure to disable “Use Gravity” so the Cube floats in front of you.
Save your scene by going to your top menu, hovering over File
and selecting Save.
Launch Your Project onto Your Meta Quest
We’re very close to being done!
Connect your Oculus Quest to your computer through a USB cable. Put on the Quest and enable USB debugging for this computer.
Back in Unity, head back up to the top menu to File and “Build Settings…” Open the Build Settings window and click on “Build and Run” in the lower right-hand corner. Alternatively you can go to the top of the Unity menu, select Oculus, and access Build and Run from there.
You can then choose a name for your APK (Android Package Kit) and select where to save it. We generally recommend creating a new folder labeled “Builds” for easy organization.
After saving, Unity will have saved your application onto your
USB-connected Quest. You can now disconnect the Quest from your computer and
launch the project.
To find your project while wearing the Oculus Quest, go to your Libraries on
the left-hand menu, select Unknown Sources, and your project should be
listed there.
What's Next
Building for the Oculus Quest is an ambitious endeavour, good job! It’s a great device to get started with.
Now that you’re setup for Oculus Quest development, you’re ready to get building more advanced projects. Check out our programming guide for tips, advice, and resources to developing a VR app.
If you’re looking for guidance in Unity development, we can help with that.
Through our 10-week course and one-on-one training, we’ll take you from idea
to prototype to finished app. Download our syllabus to learn more about what
we can teach you!
Technical Steps:
-
Unlock Developer Mode on Oculus Quest
- Download Oculus App onto your phone
- Turn on Oculus Quest
- Select Oculus App settings
- Select your Quest from the list of devices
- Select Other Settings
- Select Slider to activate Developer Mode
- Register for Developer Certificate with Oculus if you haven't done so already
-
Install Android Tools
- Download Android Studio
- Open Android Studio and Select File > Settings > Android SDK
-
Within the Package Manager, download and install:
- Android 4.4 (SDK19)
- Android 7.1 (SDK25)
- SDK Tools (within the SDK Tools tab)
- SDK - Platform Tools (within the SDK Tools tab)
-
Install and run Unity
-
Download Unity with version 2017.4 or newer
- Ensure Android Build Support selected to download as well
-
Download Unity with version 2017.4 or newer
-
Create new Unity project
- Go to Unity's Asset Store and search "Oculus Integration"
- Download, Import, or Update the plugin, depending if you've accessed it before
- If prompted, update Oculus Plugin Utilities and restart Unity
-
Install OpenVR and XR Legacy Input packages
- In Unity's top menu, go to Window > Package Manager
- Select OpenVR and XR Legacy Input Handlers
- Close Package Manager
- Note: If using an older version of Unity, the Input Handlers are built in and will not need to be manually installed
-
Set Project's Build Settings
- Go to File > Build Settings...
- Delete any scenes listed in the "Scenes in Build" area
- Click "Add Open Scenes" to add current scene to Build
- Change Platform to "Android" and set Texture Compression to "ASTC"
-
Click on "Player Settings" and change:
- Company Name
- Product Name
- In Player Settings, go to:
-
- Other Settings > Identification > Change Minimum API Level to 4.4 KitKat
- Under Identification, confirm your Package Name is along the lines of com.company name.product name
- XR Settings and confirm "Virtual Reality Supported" is enabled
- Virtual Reality SDKs section, click on "+" and add "Oculus"
- Click "Build" in Build Settings
- If you receive error message, go to Player Settings > Other Settings > Graphics API > Remove Vulcan
-
Setup Oculus Quest Controllers
-
To represent controllers by spheres:
- Add 3D Object Sphere
- Change Sphere scale to 0.1 in X, Y, and Z
- Add Tracked Pose Driver component, set Device to "Generic XR Controller"
- Add RigidBody component, enable "isKinematic" and disable "Use Gravity"
- Duplicate Sphere and change Pose Source in Tracked Pose Driver to "Right Controller." Double check the other Sphere's Pose Source is set to "Left Controller"
- Change Spheres and Main Camera position to 0, 0, 0 in Inspector
-
To represent controllers by spheres:
-
Setup VR scene
- Add 3D Object Cube
- Set Cube position to 0, 0, 1
- Add RigidBody Component and disable "Use Gravity"
- Save scene
-
Launch Unity Project onto Oculus Quest
- Connect Quest to your computer via USB
- Put on Quest and enable USB debugging for this computer
- In Unity, go to File > Build Settings... > Build & Run
- Choose name for APK; Create new "Builds" folder and save APK within
- Once Unity has finished deploying project onto Quest, disconnect Quest and put on
- Access your project from Quest Main Menu > Libraries > Unknown Sources
Download Syllabus
Download XR Development with Unity Course Syllabus