/vr-dev:unity-quest-sim-loopfrom vr-dev
Tests and debugs Unity Meta Quest apps in editor Play Mode using the Meta XR Simulator and Operator (MCP on port 8720). Injects controller/head poses, presses UI, queries app state, captures eye views, pixel-diffs objects, runs JSON scenario suites with assertions, and replays after edits. Includes headset follow-up via ADB/logcat/VrApi.
Ships in vr-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
A picture of a VR scene can't tell "the button did nothing" from "the ray wasn't on it". A headset round trip costs about 4 minutes and needs someone wearing it. So this loop swaps looking for asking:
127.0.0.1:8720.<skill> below means this skill's folder (the base directory shown when the skill loads).
Scripts are in <skill>/scripts/, C# templates and example scenarios in <skill>/assets/,
longer material in <skill>/references/. The scripts are plain Python 3.10+ (stdlib; Pillow
only for image diffs) and Windows PowerShell 5.1.
Meta XR Core SDK 205 is not required. On older SDKs the Operator layer is loaded by
environment variable, and the app's tools come through DevRemote (references/setup.md). The
loop runs in production on an SDK 203 passthrough app (DicomSegVR: controllers + fingertip UI,
AR ↔ a VR treatment room) and on an SDK 205 controller-first app.
| piece | where | for |
|---|---|---|
| Meta XR Simulator | desktop OpenXR runtime | a simulated Quest 3 with a head and Touch controllers |
| Meta XR Operator | API layer in the app, MCP on :8720 | 25 bundled tools (openxr_*, unity_*, math_*, convert_*) plus the app's own |
| MCP proxy | %USERPROFILE%\meta-xr-operator\meta-xr-operator-mcp-proxy.exe | stdio ↔ :8720; the backend URL is its first argument |
app tools <prefix>_* | the project's AgentTools (editor + dev builds) | the app reporting on itself and acting for the hand: state, open a screen, press a named button, snapshot, renderers |
| DevRemote | editor, loopback HTTP :8731 (up to :8739 if taken) | status / play / stop / refresh / compile, plus /tool/NAME for the app's tools on any SDK |
| layer copy | %USERPROFILE%\meta-xr-operator\layer\x64 | the Operator for projects whose SDK doesn't ship it (pre-205) |
Horizon OS dev MCP (metavr / hzos-dev-mcp) | MCP | Meta docs + API search, device logcat and screenshots, Perfetto (the horizon-os-mcp skill) |
| adb command channel | assets/DevCommandChannel.cs + assets/OperatorLayerExclusion.cs, host side scripts/adbtools.py | the app's tools on a headset whose dev build must go without the Operator layer (device.md) |
scripts/run_scenario.py | host | JSON scenario suites: call, wait, assert, aim, capture - the regression suite of L1 and L2 |
scripts/quickcheck.ps1 | host | L0: Roslyn compile of the project's assemblies in ~10 s without the project lock |
scripts/panelshot.py | host | aims the simulated head at a named panel and snapshots it framed tightly, to read its text |
| loop | cost | proves |
|---|---|---|
L0 quickcheck.ps1 + headless gates / EditMode tests | 10 s – 90 s | it compiles (editor AND device defines), and the scene is wired as the gates expect |
L1 editor Play Mode + simulator + Operator (+ run_scenario.py suites) | seconds per check | the app runs, and simulated input changes state as intended |
L2 development APK on the headset + Operator over adb forward (or the adb channel) | ~4 min, needs a worn headset | real tracking, hands, GPU, performance |
| L3 release APK + a smoke checklist | ~4 min | the build that ships (it has no Operator layer) |
Climb only as far as the question needs. Most bugs are found and fixed in L1. Building and
sideloading is the quest-build-deploy skill.
python <skill>/scripts/reload.py status # editor: isPlaying, isCompiling, last 40 errors (finds the port)
python <skill>/scripts/op.py list # Operator tools + the app's [remote] tools, merged
[OFFLINE]: the proxy runs but no app is attached
to :8720. Start Play Mode (step 2) or launch the dev APK on the headset.myapp_*): it's live. Go to step 3.DevXr / DevRemote / AgentTools: set it up first, see
references/setup.md. The templates compile as-is on SDK 205 with asmdefs and on SDK 203
in Assembly-CSharp; most of the work is the app's own tools file.powershell -File <skill>\scripts\editor-play.ps1 -Project C:\path\to\MyQuestApp [-Restart]
The script:
-executeMethod <Ns>.DevXr.CliPlay, which opens the scene,
activates the Operator and the simulator, and arms an auto-play that survives cold-start
domain reloads;isPlaying:true.A cold start takes 2–4 minutes. Then wait until the app has registered its tools. This
happens after the OpenXR instance exists, not at Play:
python op.py wait myapp_get_state 180.
Headless Unity runs (gates, tests, builds) take the project lock, so the editor must be
closed for them. Only the Roslyn quickcheck runs beside an open editor. -Restart kills
every Unity editor, so if the user may be looking at it, say so before you do.
Use the Operator's MCP tools directly if your agent has the meta-xr-operator server
registered (references/setup.md). Otherwise use the bundled client, which works from any
directory and in any agent:
python op.py call myapp_get_state
python op.py call openxr_set_controller_input @press.json # args from a file: no quoting fights in PowerShell/bash
python op.py batch scenario.json --out <tmp>/shots # [[tool, args], ["sleep", {"s": 0.4}], ...] in one session
Shape every check the same way:
A check that ends in "the screenshot looks right" asserted nothing.
The things that cost hours to learn (details and more recipes in references/operator.md):
Coordinates: OpenXR local_floor is Unity world with z negated. Quaternions
negate x and y.
Buttons: openxr_set_controller_input {hand, component, value, auto_release: true}.
sub_component X or Y.Aiming: the Interaction SDK builds the controller ray from the grip pose plus
Meta's fixed offset, so setting the aim pose moves nothing. Use
scripts/aimfix.py HAND fx fy fz tx ty tz --tool <prefix>_get_input_state (Unity world
coordinates), or an aim step in a scenario. It reads the ray the app reports and corrects
the grip until the ray hits the target to within 0.3°.
Control vs aim: when a button "doesn't work", compare two presses:
myapp_click_widget);Fails both ways → the handler logic. Fails only through the ray → aim, the raycast, or the event path.
Fingertip-touch UI ignores controller rays: the ray can converge on a button to 0.1° and hover nothing, because those canvases are built for fingertip touch. The Operator can't move hand joints, so the app needs two tools:
myapp_press → the
button's own TryPress);myapp_poke). That
tests the physics link press skips: collider placement, size and layers.Press works but poke fails → a collider or layer bug. Only real hand tracking and gesture detection (a palm menu) are left for the headset.
Head: openxr_set_head_pose works in the simulator. It also re-seeds both
controllers, which lose their pose and switch to simulated: true, so read the grip poses
first and restore them afterwards. On a device the head follows the real headset.
Quaternions at full precision: [0.5, 0, 0, 0.8660254], never 0.866. A slightly
non-unit quaternion makes the Interaction SDK log "Quaternion To Matrix conversion failed"
every frame (5,000 lines in two minutes).
Put things back. Restore every pose and toggle you changed, then compare a final capture with your first one. The user, or the next check, inherits the session.
unity_find_interactables only sees uGUI Selectables. Custom widgets need an app tool
that lists them.
Every check worth doing twice becomes a scenario file, run by scripts/run_scenario.py
against the editor (L1) or a dev build on the headset (L2, --device). The app's answers are
asserted, not eyeballed, and a failing step prints the symptom as the user would see it.
python <skill>/scripts/run_scenario.py <project>/tools/sim-scenarios/*.json --prefix myapp --project <project>
python <skill>/scripts/run_scenario.py smoke.json --prefix myapp --device --pkg com.Company.App
{"name": "load_sample", "steps": [
["myapp_load_sample", {"id": "demo"}],
["wait", {"tool": "myapp_get_state", "path": "dataset.ready", "equals": true, "timeout": 90,
"symptom": "the sample never finishes loading"}],
["assert", {"tool": "myapp_get_state", "path": "windows[*].title", "none_contains": "Downloading",
"symptom": "the window title is stuck on 'Downloading 100%'"}],
["aim", {"hand": "right", "target": {"tool": "myapp_ui_point", "args": {"name": "Close"}},
"expect_hovered": "Panel_Viewer"}],
["openxr_set_controller_input", {"hand": "right", "component": "Trigger", "value": 1, "auto_release": true}],
["assert", {"tool": "myapp_get_state", "path": "windows[id=viewer].open", "equals": false}]]}
sleep, wait, assert, capture (remember a value, compare later
with greater_than: {"var": ...}), aim, composite (save the composited eye image),
layers_match (compositor layers sit exactly on their canvases). The full grammar is the
script's docstring; assets/scenarios/ has starting points.{"error": ...} answer or a non-JSON answer
fails every check. A tool that threw must never turn "no title contains Downloading" green.tools/sim-scenarios/), named after what they protect, and
re-run the touched ones after every fix. On the DicomSegVR app, 55 L1 scenarios cover
input, panels, the RT tools, the AR ↔ VR room switch and teleport.Capture from the pose you found. A narrow snapshot fov zooms without moving anything. Move the head only if the object isn't in view: that re-seeds the controllers, and you then have to restore them.
Passthrough apps: the composited image shows the simulator's synthetic room (a bedroom) where passthrough would be, which is the honest "what the user sees". The app snapshot has a transparent background.
Three ways to capture, best first:
openxr_capture_composited_image {eye: "left"|"right"} returns what the runtime
actually composited for that eye (840×880 in the simulator), compositor layers included.
It works on simulator v207 (v205 answered "not instrumented"); if it fails, fall through.myapp_snapshot {width, height, fov, name}) renders the
centre eye offscreen with the real camera and skybox, at any size and field of view. A
narrow fov (18–30°) makes a close-up without moving anything. In the editor the PNG lands
in <project>/Temp/<prefix>-snapshots/. Unity wipes Temp on every launch, so copy
keepers somewhere outside the project.scripts/grab-window.ps1 -Title "Meta XR Simulator" -Out <path> captures a window
with PrintWindow.To read a panel's text, python scripts/panelshot.py --prefix myapp Panel:Settings settings [--click TabAdvanced]
turns the head to the panel, sizes the fov to it and snapshots at a resolution text can be
read at. It re-reads the panel list after the head turn (the app may re-lay the workspace
out) and leaves the controllers re-seeded. A panel drawn as a compositor layer is a HOLE in
the app snapshot: capture composited, or switch the compositor path off.
Open the PNG with Read and look critically. Is every structure the colour it should be? Are panels overlapping? Are controllers textured? Is the floor there? Attach it to your reply when the user needs to see it.
To prove one object's colour or visibility, diff instead of eyeballing.
python scripts/imgdiff.py ON.png OFF.png --control ON2.png --expect "#ff3b30". It
prints the object's own pixel count, median colour, hue histogram and noise floor, and
writes a mask image.Those numbers plus the mask are evidence; a crowded screenshot is an argument.
When something is "invisible, flat or untextured", query before you theorise.
myapp_debug_renderers {contains} gives active, visible, material, shader, texture, colour,
queue, layer and bounds for each match. That tells a missing texture from a hidden object
from something drawn over it. The last one was a reversed-Z skybox painting over every
opaque object; see references/pitfalls.md.
CliPlay sets
EditorPrefs ScriptCompilationDuringPlay = 1 (recompile after playing).scripts/quickcheck.ps1 -Project <project> [-Editor] [-Dev] (~10 s,
no project lock). It compiles against Unity's own response files, so the editor defines
AND (-Dev) the player's defines are checked: dev-only code that leaks into a release
build fails here, not after a 20-minute APK build.python scripts/reload.py --wait-tool myapp_get_state. It stops Play Mode,
POSTs /refresh, waits for the compile, refuses to play on compile errors, plays, and
waits for the app's tools. /refresh matters because an editor without window focus never
imports files changed on disk. If stopping Play hangs (no isPlaying:false, DevRemote
silent), don't wait: editor-play.ps1 -Restart.python scripts/reload.py --refresh-only. They
hot-reload in Play Mode./status holds the last 40. For Editor.log
(%LOCALAPPDATA%\Unity\Editor\Editor.log) or a batchmode log, run
python scripts/logscan.py [LOG] [MARKER] [--info]. It prints distinct warnings and errors
with counts and origins, so 30,000 identical NREs read as one line. Use
"entering Play Mode" or your app's own startup line as the MARKER to scope it to this
Play session. Add --info when the complaint is "console spam": that is usually a
per-frame or per-second Debug.Log, not an error.A simulator finding isn't done until a headless check would catch it again:
-nographics. Under
-nographics, ReadPixels returns uniform grey, which gives a confident, fabricated
verdict. The gate must also render the app's real frame, including its skybox. A check
that clears to a solid colour isn't checking the app.When the simulator can't answer, go to the headset. That covers real tracking,
hands/Capsense, the device GPU and shader paths, compositor layers, and performance. See
references/device.md for:
adb install -r -g;debug.* sysprops and adb forward tcp:8720 tcp:8720;sys.hmt.mounted = 1), or every Operator call times out
"waiting for main thread";DevCommandChannel +
adbtools.py, or run_scenario.py --device);SF= is the eye-buffer scale dynamic resolution chose, and a
scripted run that pins it measures the best case, not what the user sees;grep for a log line you haven't
copied from the script, and always pair a poll with a "producer process is gone" exit
(references/pitfalls.md → "Never wait on a guessed log marker").For Meta docs, API lookups, device logcat/screenshots and Perfetto traces, use the
horizon-os-mcp skill: check a Meta SDK name against the docs before relying on memory,
because names change between SDK versions.
git status for assets the editor rewrote during play (TMP
font assets, scenes, Assets/_Recovery) and revert the ones you didn't mean to change.assets/AgentTools.cs (opens in a new tab)assets/AppAgentTools.cs (opens in a new tab)assets/DevCommandChannel.cs (opens in a new tab)assets/DevRemote.cs (opens in a new tab)assets/DevXr.cs (opens in a new tab)assets/OperatorBridge.cs (opens in a new tab)assets/OperatorLayerExclusion.cs (opens in a new tab)assets/scenarios/ray_click.json (opens in a new tab)assets/scenarios/smoke.json (opens in a new tab)evals/evals.json (opens in a new tab)references/device.md (opens in a new tab)references/operator.md (opens in a new tab)references/pitfalls.md (opens in a new tab)references/setup.md (opens in a new tab)scripts/adbtools.py (opens in a new tab)scripts/aimfix.py (opens in a new tab)scripts/editor-play.ps1 (opens in a new tab)scripts/grab-window.ps1 (opens in a new tab)scripts/imgdiff.py (opens in a new tab)scripts/logscan.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
quest-debugging, xr-simulator, xr-operator, headless-testing, openxr
4 skills in this plugin
/blender-cli-vr-assetsBuild VR-ready 3D assets with headless Blender driven from the command line (blender -b, bpy stage scripts) and hand them to Unity for Meta Quest - rooms, props and jointed machines built by scripted stages, Cycles light baked display-referred into atlases drawn unlit, gated by validation, exported as byte-deterministic FBX with the axis conversion and joint contract Unity needs, and checked against Cycles reference renders with SSIM and CIEDE2000. Use it whenever the user runs or writes Blender in background / CLI mode or bpy scripts; generates or fixes 3D assets, rooms or props for Unity or Quest; exports FBX for Unity (wrong axes, scale, joints in the wrong place); bakes lighting or AO into atlases; wants Unity to match a Blender render; or wants a scripted, deterministic asset pipeline. Includes a stage runner, bpy helpers, a deterministic-FBX patch, a fidelity gate and an example./horizon-os-mcpConnect and use Meta's Horizon OS developer MCP server (metavr via npx, or hzos-dev-mcp bundled with Meta Quest Developer Hub) for Quest work - authoritative Meta docs and exact Unity/Unreal API signatures, device control (list, apps, files, logcat, screenshots, UI automation), and Perfetto performance traces with baseline comparison. Use it before relying on memory about any Meta XR SDK name, setting, manifest entry or Store/VRC rule; when a Quest app crashes, stutters or runs hot; when the user asks to install, launch, inspect or capture something on the headset; or when setting up, checking or repairing the MCP connection itself.npx claudepluginhub gomesgustavoo/vr-dev-skills --plugin vr-devOther plugins' skills for the same job