XR Step-by-Step! Setting up your Oculus Quest XR project in Unity 2022!

Virtual and Augmented Reality together are now referred to as XR or “Extended-Reality”. You’re in the right place at the right time to build something amazing in XR!

XR applications can be created in Unity for many devices, our focus will be on Microsoft Hololens and the Oculus Quest 2 – in this blog post series we will specifically focus on Oculus Quest 2 in the latest Unity 2022.

Let’s start building our XR experience together! Now in the latest Unity 2022!!

Here’s my XR Step-by-Step blog series to help you create your XR experiences!

Unity 2022
1) Installing the Tools you need for XR development == Unity 2022
2) Setting up your Oculus Quest XR project in Unity 2022!

3) Helpful Asset Packages & Libraries for Unity 2022
4) Organizing your Unity Projects

5) Setting up Mixed-Reality Passthrough for your Meta Quest XR project in Unity 2022!

Unity 2021

1) Installing the Tools you need for XR development == Unity 2021
2) Setting up your Oculus Quest XR project in Unity 2021!

3) Setting up Mixed-Reality Passthrough for your Oculus Quest XR project in Unity 2021!
4) Keep your XR project safe with a GitHub Code Repo!
5) Setting up Touch Controller for your Oculus Quest XR project in Unity 2021!
6) Coding your Touch Controller for your Oculus Quest XR project in Unity 2021!

For Quick Reference, here is the summary of all steps to setup your XR project – followed by the detailed Step-by-Step with images and additional BONUS content at the end!

  1. (Template) 3D -> Create Project
  2. *(Toolbar) Window -> Layouts -> Wide (*optional)
  3. (Project Window) Right-click -> Create -> Scene
  4. (Hierarchy Window) Right-click on the Main Camera -> Delete
  5. (Toolbar) File -> Build Settings
    • (Build Settings) Add Open Scenes -> Check/Uncheck Scenes
    • (Build Settings) Platform -> Android -> Switch Platform
  6. (Toolbar) Edit -> Project Settings…
    • (Project Settings) Player -> Change Company Name
    • (Project Settings) Player -> Other Settings -> Color Space should be Linear
    • (Project Settings) XR Plug-in Management -> Install XR Plugin Management button
    • (Project Settings) XR Plug-in Management -> Check the Oculus option under the Android + Windows tab
  7. (Toolbar) Window -> Package Manager
    • (Package Manager) Switch from Packages: In Project -> Packages: My Assets
    • (Package Manager) Click Oculus Integration -> Import (Answer Yes, Ok, Delete Depreciated Assets, etc)
  8. (Project Window Search Bar) Search for OVRCameraRig -> Drag OVRCameraRig Prefab into scene
  9. (Toolbar) File -> Build Settings…
    • (Build Settings) Run Device -> choose Quest device -> Click Build and Run button
    • (Build Android) File Name -> name it Install -> Click Save

Full Step-by-Step Instructions!

  • Open Unity Hub and click New Project
  • (New Project Window)
    1. (Editor Version) Select the latest version of 2022 in the drop down
    2. (Templates) Choose the 3D -or- 3D (URP) template
      • We’re choosing the 3D template as it most compatible with existing assets, models, etc. that we download
      • If you haven’t used the template before, you’ll need to click on Download and then Install the 3D URP template.
    3. (Project Name) Name your XR project!
    4. Click Create Project
  • Creating a project takes a couple of minutes – as the base projects are pretty large (~1.2GB) — here’s what we get!
  • Pro-Tip: (Toolbar) Window -> Layouts -> Wide
    • There are several different layouts of your Unity windows, I prefer “Wide” layout.
  • So we’re all talking about the same things, here are the parts of the Unity Window and what they’re called.
  • (Project Window) Under Assets click on Scenes. Think of scenes as different levels in a game.
  • (Project Window) Right-click -> Create -> Scene. Name it Main (or whatever).
  • (Project Window) Double-Click on your new scene name so it shows up in the (Hierarchy Window).
  • (Hierarchy Window) Right-click on the Main Camera -> Delete.
    • We do this because we we’re going to add a better camera for VR later.
  • (Toolbar) File -> Build Settings
    • Now that we have a new scene we’re going to configure your project for VR
  • (Build Settings)
    1. Click on the Add Open Scenes button
    2. (Platform) Click on Android
    1. Click on the Switch Platform button
  • (Toolbar) Edit -> Project Settings…
  • (Project Settings) Player -> Change Company Name, for example “HoloSoft”
  • (Project Settings) Player -> Other Settings -> Change Color Space to Linear
  • (Project Settings) XR Plug-in Management -> Install XR Plugin Management button
  • (Project Settings) XR Plug-in Management -> Check the Oculus option under the Android settings tab
  • (Project Settings) XR Plug-in Management -> Check the Oculus option under the Windows, Mac, Linux settings tab
  • Go to assetstore.unity.com -> Search for Oculus Integration
    • If you aren’t signed in – or don’t even have an account – create one and login 🙂
  • Click on Add to My Assets
  • (Toolbar) Window -> Package Manager
  • (Package Manager) Switch from Packages: In Project -> Packages: My Assets
  • (Package Manager) Click Oculus Integration -> Import
  • (Import Unity Package) Click Import
    • We see that there are a lot of assets that are part of this package, I encourage you to glance through them and in the future you may only want some of them – but for now just click on Import and we’ll add all of them to our project
  • This will likely take several minutes, and we should expect to click through quite a few dialog boxes as follows…
  • (Project Window Search Bar) Search for OVRCameraRig -> Drag the OVRCameraRig Prefab (the one with the blue square) into your (Hierarchy Window) Scene
  • BONUS: Let’s add a Cube so we can test XR project!
  • (Hierarchy Window) Right-click -> 3D Object -> Cube
  • Click on the (Game Window) tab – so we can easily see what we’re changing
  • (Hierarchy Window) Click on Cube asset -> (Inspector Window) Change Position, Rotation and Scale to the following…
    • Setting the Scale to 0.5 make the cube smaller
    • Setting the Rotation by 45 (degrees) on both Y and Z makes it more interesting to look at 🙂
    • Setting the Z Position puts it in front of the user when they start the XR project
  • Let’s make the Cube spin!
  • (Inspector Window) Click Add Component button
  • (Inspector Window) Enter script in search bar -> Click on New script and name your script “Spinner”
  • (Project Window) Click on your Spinner script and you’ll see the script in the (Inspector Window)
  • (Project Window) Double-Click on your Spinner script and it will open Visual Studio
  • You’ll see two methods in your C# script
    • Start(): Runs once before the cube is created in the scene.
    • Update(): Runs every frame, refresh is generally 60 to 90 frames/second.
    • Just add the two lines below and Save your changes!
  • (Inspector Window) You will see your update code in Unity!
  • (Hierarchy Window) Select Cube
    • Set the Rotate Amount for X, Y and Z = 0.1 (play around with these values!)
  • Now let’s run your project on your Quest!
  • (Toolbar) File -> Build Settings…
  • (Build Settings) In Run Device -> choose your Oculus Quest device
    • If you don’t see your device, check that it’s connected via USB
    • That you click Yes to allowing the device to connect to the computer (comes up in the device)
    • Click Refresh, and hopefully you see your device there!
  • Click Build and Run button
  • (Build Android) In File Name -> I usually name it Install, could be anything -> Click Save

  • That’s it! You should now see a rotating cube in your XR experience on your Quest! Congrats to you!

Love any feedback and see you in future XR blog posts.

Build something amazing in XR! — Lance

Here’s my XR Step-by-Step blog series to help you create your XR experiences!

Unity 2022
1) Installing the Tools you need for XR development == Unity 2022
2) Setting up your Oculus Quest XR project in Unity 2022!

3) Helpful Asset Packages & Libraries for Unity 2022
4) Organizing your Unity Projects

Unity 2021

1) Installing the Tools you need for XR development == Unity 2021
2) Setting up your Oculus Quest XR project in Unity 2021!

3) Setting up Mixed-Reality Passthrough for your Oculus Quest XR project in Unity 2021!
4) Keep your XR project safe with a GitHub Code Repo!
5) Setting up Touch Controller for your Oculus Quest XR project in Unity 2021!
6) Coding your Touch Controller for your Oculus Quest XR project in Unity 2021!

9 thoughts on “XR Step-by-Step! Setting up your Oculus Quest XR project in Unity 2022!”

Leave a Reply