text
stringlengths
0
1.11k
Oculus XR Plugin - An extension of the Unity VR subsystem that communicates with OVRPlugin.
Note: The tutorial uses Unity Editor version 2021.3.20f1 and Meta XR All-in-One SDK v59. Screenshots might differ if you are using other versions, but functionality is similar.
Step 1. Connect headset over USB
You must set the headset into developer mode and connect it to your computer with a USB cable.
Put on your Meta Quest headset and sign into the account you want to use for development.
On the headset, go to Settings > System > Developer, and turn on the USB Connection Dialog option.
Connect the headset to your computer using a USB-C cable.
When prompted to allow access to data, select Allow.
Allow connection to headset
Step 2. Create new project
Leave your headset aside for now and follow this process:
Open Unity Hub.
On the Projects tab, select New project. If you have installed multiple Unity versions, select the version you want for this project.
Select the 3D Core template.
Under Projects Settings, enter HelloWorld as the Project name, choose the location to store it, and select Create project.
Create Unity project
Step 3. Create a Cube GameObject to display to user
Although not essential, this step will help you confirm that a basic primitive renders on your Meta Quest headset without any issues.
In Unity Editor, go to GameObject > 3D Object > Cube.
Add Cube GameObject
Update the cube’s Position to [0, 0, 2] and Scale to [0.2, 0.2, 0.2].
Update Cube GameObject
Save your project.
You should now have a cube GameObject in your SampleScene.
Step 4. Import Meta XR All-in-One SDK from the Unity Asset Store
Later, you will learn how to import only the SDKs you need so that you reduce the size of your app, but for now, import all of it.
Navigate to Window > Package Manager to open the Unity Package Manager pane.
Go to the Unity Asset Store page and log in if needed.
Select Add to My Assets button.
Select Open in Unity to start the integration process with the Package Manager in Unity. If asked, allow Asset Store Links to be opened by Unity.
Wait for the Unity Package Manager window to open.
On the “Meta XR All-in-One SDK” pane, click Install.
When prompted to restart Unity, click Restart Editor.
Restart
Step 5. Set up Android device Build Settings
The target platform for Meta Quest headsets is Android and the final output is an .apk file.
In Unity Editor, go to File > Build Settings.
In the Platform list, select Android, and select Switch Platform.
Switch Platform
While still in the Build Settings window, focus on the Run Device list and select your Meta Quest headset. If you don’t see the headset in the list, ensure you have connected it properly and select Refresh.
Run Device settings
Step 6. Run Unity Project Setup Tool
Navigate to Oculus > Tools > Project Setup Tool. The Unity Project Setup Tool has rules for creating a new application with Meta Quest in Unity.
In the checklist under the Android icon tab of the Project Setup Tool, select Fix All.
Project Setup Tool Fix All This applies the required settings for creating Meta Quest XR apps, including setting the minimum API version, using ARM64, and installing the Oculus XR Plug-in and XR Plug-in Management package.
If you still see Recommended Items in the list, select Apply All.
Project Setup Tool Apply All This optimizes project settings for Meta Quest Unity apps, including texture and graphics settings.
Repeat the process of Step 6 for Windows, Mac, Linux settings as needed until you see no recommendations.
Step 7. Add OVRCameraRig to scene
Meta XR Core SDK contains the OVRCameraRig prefab which is a replacement to Unity’s main camera. This means you can safely delete Unity’s main camera from the Hierarchy tab.
The primary benefit of using OVRCameraRig is that it offers the OVRManager component (OVRManager.cs script). OVRManager provides the main interface to the VR hardware.
Follow this process:
Under Hierarchy tab, right-click Main Camera, and select Delete.
In the Project tab, search for Camera Rig, and drag the OVRCameraRig prefab into your scene. Alternatively, drag it in the Hierarchy tab.
Add OVRCameraRig