Repository for the code that runs on the Oculus quest 2.
These steps are needed to run the uity project with all the necessary dependencies.
-
Start by installing unity hub here.
-
Clone this repository somewhere on your computer.
-
Go on the unity hub app and go to the projects tab (usually the tab that's already openned when openning the app).
-
Click on
Add > Add project from diskand select the folder where you cloned this project. -
You should now see the
oculus-codeproject. On that project, you should see a yellow triangle (warning sign). Click on it. If you don't see the warning sign, continue to step 10. -
In the new window that just appeared, simply click on the
Install Version 6000.1.3f1button without changing anything. -
Now, you should see modules that you can download. You should select the following modules:
- Android Build Support
- OpenJDK
- Android SDK & NDK Tools
Once that is done, click on the
Continuebutton. -
You can now check the checkbox to say that you have read and agree with the terms and conditions. After that, click on the
Continuebutton. -
And again, check the checkbox to say that you have read and agree with the terms and conditions. After that, click on the
Installbutton.This process can take a while depending on the PC and internet connection speed that you have. Just be patient. You can go ahead and setup the ADB in the meantime if you want and come back when unity is done installing stuff.
You can now skip to step 13 since you have already installed the Android dependencies (just launch the project).
-
Go to the
Installstab on the left of the app. -
Click on the Parameter icon button on the installation that is present and then click on
Add modules(6.1 should be the one that is compatible with the project). -
Select the following options and click on the
Installbutton.
If they are already selected, simply go to step 13.- Android Build Support
- OpenJDK
- Android SDK & NDK Tools
-
Once all of this is installed, you can go back to the
Projectstab and launch the project.
ADB (Android Debug Bridge) is a tool which alows us to take the build from unity and upload it to the oculus quest 2 headset.
-
Start by downloading ADB here.
-
Then, unzip the downloaded zip file somewhere like your
C:drive as it will be added to your environment variables. -
To make sure it works, open a command prompt, also called cmd, (not powershell as it won't work) and open the
platform-toolsfolder in the folder you just unzipped. -
Run the following command in that folder (there should be a program called
adb.exe).adb devices
-
You should see a list with the quest 2 if it's connected to your PC.
Important note: if it shows as
Unauthorized, you will need to allow the USB connection in the Quest 2 headset. If there are no pop-up showing up in the headset, unplug and replug the usb-c cable in the computer. The pop-up should now show up. You should accept it. the device should now show asdevice.What you should see:
List of devices attached 1XXXXXXXXXXX device
-
Add ADB to your PATH variables.
In order to make sure ADB is avaible everywhere on your PC, you will want to follow the following steps:-
Click on the windows icon in the taskbar of your PC and search for
Edit the system environment variablesthen open it. -
In the window that just opened, click on the
Environment Variables...button. -
In System variables, select
Pathand click on theEdit...button. -
Click on the
Newbutton then on theBrowse...button. You'll want to go to theplatform-toolsfolder that you jsut downloaded and then click onOk. -
To make sure that the changes are persisted through all your command prompts, close the ones that are opened and run
adb devicesanywhere on your PC to make sure that it still works.
If it doesn't work, make sure you put the right file path and thatadb.exeis not included in the path that you jsut added.
-
This section will show you how to build the unity project as an android application that is runnable on the oculus quest 2.
-
On the toolbar at the top of the unity application, click on
File > Build Profiles. -
It should bring you to the Android platform where you can see
BuildandBuild and Runbuttons. (Check that you are on the Adnroid platform by looking in the left menu and Android should be selected).If you are on Windows, click and Android is not selected, click on the Android tab on the left and on the bottom left of the window, click on
Switch Platformbutton. -
When you are ready to build the project, click on the
Buildbutton on the botton left of this windowNext, create a folder somewhere on your PC (not in the repository) where you'll want to store your builds. You can call it
OculusBuildsfor example.Then, you'll want to name the build file in this format
oculus-app-X.X.X.apkwith the letters X representing the numbers of the current build version. For example, the first build version is 0.1.0 so the name of the build wasoculus-app-0.1.0.apk.If there's a pop-up that appears, simply click
Yes.Important note: The first build you ever do on your machine can take anywhere from 20 to 30 minutes so, be patient. The following build should be faster depending on what you change in-between builds.
-
Once the build is finished, you can now deploy it by following the deploy instructions.
This section will walk you through the steps that you need to do to deploy this application on the oculus quest 2.
-
First, open a command prompt (or cmd) and go to the folder where you created the builds for Android that will be uploaded to the oculus quest 2.
If you followed the build walkthrought, that folder should be calledOculusBuilds. -
Now, we'll install the build onto the oculus quest 2 by entering the following command(s) in the command prompt (Take the time to read the section below to know which commands to run):
If the application has already been installed on the oculus quest 2 from another PC, enter the following command:
adb uninstall com.realsteelproject.oculusapp
Then you should run this command to install the application onto the headset (Replace the letters X with the version you are currently installing):
adb install oculus-app-X.X.X.apk
Lastly, if you are the last person to have intalled a buid onto the headset, you can simply run this command (Replace the letters X with the version you are currently installing):
adb install -r oculus-app-0.1.0.apk
-
You just need to send this command and the app should be available as
oculusAppon the oculus quest 2:adb shell am start -n com.realsteelproject.oculusapp/com.unity3d.player.UnityPlayerGameActivity
Made with care by @Funnyadd, @ImprovUser, @cjayneb and @RaphaelCamara ❤️