Welcome back to part 4 of the VR series! Four articles in, and we have yet to put a single object in front of anyone's eyeballs. I had some issues setting this up myself, but eventually I was able to figure it out. If you've missed any of the previous parts, click here.
Alright, this is the Unity Meta Quest Hello World article. We're going to get one cube, spinning slowly, into your headset. That's it. No gameplay, no hands, no fancy shaders (yet).
Why so incredibly boring on purpose? Because the cube isn't the point. The point is making sure that your whole trajectory works: Unity, the SDK, the build, the headset. Once your cube makes it through, everything after this is "just" game dev. And when something breaks later, you'll know it wasn't your setup, makes sense?
Here's the plan:
Step 1: Start With A Clean Project
You have two options here, and both end up in the same place.
Meta's current Quickstart has you create the project through Meta Quest Developer Hub: open MQDH, pick XR Projects in the sidebar, and hit Create project. It sets up a Unity project that's already pointed at Meta's SDKs.
Or you can go the manual route we covered in Part 2: a fresh 3D project, the Meta XR SDK from Part 3, and the Project Setup Tool. If you did that already, you're good. Don't redo it.
Either way, before moving on, make sure you double-check two things:
- The Project Setup Tool is clean! Open it and check that there are no remaining required issues, and check both the Standalone and Android tabs.
- OpenXR has the Meta XR feature enabled. In Edit → Project Settings → XR Plug-in Management → OpenXR, the Meta XR feature group should be on for Standalone and Android.
Yes, I said "Android tab only" in Part 2. Meta's current docs ask you to check both tabs, so check both. Better safe than debugging.
Step 2: Swap The Main Camera For A Camera Rig
Remember the OVRCameraRig from Part 3? Time to use it.
First, find the Main Camera in your Hierarchy, right-click it, and delete it. Two cameras fighting over the player's view is a bad time for everyone.
Then open the Building Blocks window (it lives under the Meta menus in Unity's menu bar, and Meta occasionally moves it around) and click Camera Rig. That drops an OVRCameraRig into your scene, and with it, head tracking.
Check your Hierarchy. You should see the rig, and no other camera. If you do, your player now has a head. Congratulations, you've done the hardest part of VR.
Step 3: Add A Cube (And Check The Scale!)
Create the cube with GameObject → 3D Object → Cube.
Now here's the thing that trips up every flat-game dev in VR: one Unity unit is one meter in the real world. A default cube is a full meter wide. In a headset, that's a refrigerator-sized box in your face.
So set the cube's Transform to something like this:
- Position: 0, 1.2, 1.5 (in front of the player, around chest height)
- Scale: 0.3, 0.3, 0.3 (about the size of a toaster)
If the cube feels too high or too low when you test, just nudge the Y value. Different tracking origin settings can shift things a bit, and this is a very cheap thing to tweak.
Step 4: Make It Spin
Alright, a static cube proves your scene renders. A spinning cube proves your game loop is running, and it's much easier to notice at a glance. So let's add a tiny script. Create a new C# script called SpinCube, attach it to the cube, and paste this in:
using UnityEngine;
public class SpinCube : MonoBehaviour
{
[SerializeField] private float degreesPerSecond = 45f;
void Update()
{
transform.Rotate(0f, degreesPerSecond * Time.deltaTime, 0f);
}
}
Nothing VR-specific in there, and that's the whole point. Your regular Unity knowledge still works! Multiplying by Time.deltaTime keeps the speed consistent no matter the frame rate, which matters even more in VR, where frame rate dips are very noticeable.
Step 5: Test It Before You Build It!
Building an APK and installing it takes a while. Doing that for every tiny change gets old fast, so Meta suggests testing in a ladder, from fastest to slowest:
Meta XR Simulator → Meta Horizon Link → Build And Run
Here's how each one works:
- Meta XR Simulator: No headset needed. Install the standalone Simulator app (it runs on Windows and Apple Silicon Macs), then click the Simulator icon next to Unity's Play button, or go to Window → Meta → Meta XR Simulator → Activate. Check the Console for a message saying it's activated, press Play, and use the mouse to look around and WASD to move. If a cube appears and spins, you're in business.
- Meta Horizon Link: Streams your running scene from the editor to your headset, so you see it with real head tracking and no APK build. It needs a Windows PC and a USB or Wi-Fi connection.
- Build And Run: The real deal. This builds the app and runs it on the headset itself. It's the slowest, so save it for when the quick tests pass.
When you finish with the Simulator, deactivate it from the same menu before switching to headset testing. Otherwise you might wonder why your headset is being ignored.
Step 6: Build And Run On The Headset
Okay, the main event. Make sure your headset is connected by USB, and that adb devices from Part 2 still sees it.
Then:
- Open File → Build Profiles and select your Quest or Android platform.
- Make sure your scene is in the scene list. Use Add Open Scenes if it's missing.
- With the headset connected, click Build And Run.
- Pick a place to save the APK file, and wait.
The first build is slow. Unity compiles a lot of stuff for the first time, so go grab a snack. Later builds are quicker.
When it finishes, Unity installs the app on your headset and launches it. Put the headset on. You should see your cube, spinning in front of you, exactly where you placed it. Walk around it. Lean in. Poke your head through it if you're feeling brave.
If the app doesn't launch automatically, look in your headset's Library for an Unknown Sources section, where apps installed from a computer usually show up.
When Your Cube Doesn't Show Up
The "why is my cube missing" checklist:
- Black screen, no cube: Check that OpenXR is enabled on the Android tab, and that the Project Setup Tool has no red items left.
- Cube is inside your head: Your cube is at 0, 0, 0 and you're standing there too. Move it forward on the Z axis.
- Cube is huge: You didn't scale it down. A one-meter cube is bigger than you'd think.
- Cube doesn't spin: The script isn't attached to the cube, or it has a compile error. Check the Console.
- Build fails: Revisit the Android modules from Part 2. Most build errors come from missing SDK, NDK, or JDK pieces.
- Two cameras, weird view: The old Main Camera is still in the scene. Delete it.
What You Just Proved
That cube means a lot more than it looks like:
Unity Works + SDK Works + Rig Works + Build Works + Headset Works
Your whole pipeline is solid. From here on, anything that goes wrong is a game problem, not a setup problem, and that's a much nicer kind of problem to have.
What's Next
In Part 5, we tackle locomotion and comfort: teleporting, smooth movement, vignettes, and why VR developers obsess over making sure players don't feel sick. Your cube will be waiting.
See you guys in Part 5!



No comments:
Post a Comment