Premier commit du cinquième front. Trois parties : - `unity/MyInfoMateVR/` : le projet Unity (6000.0.83f1, URP, Meta XR SDK 205), un APK unique pour tous les clients. Menu flottant à sélection au regard, appairage, chargement de scène GLB, POI, cache de contenu, télémétrie. - `unity-overlay/` : les mêmes scripts à recopier sur un projet Unity neuf, avec les pièges rencontrés consignés dans son README. - `viewer/` : viewer et éditeur de scène web autonome (Vite, TypeScript, three.js), partagé avec les autres fronts. - `docs/` : état des lieux, setup Unity, décisions d'architecture et plan d'exécution en 9 étapes. La scène est décrite par un `scene.json` poussé par `adb push` : l'app le préfère à celui embarqué dans l'APK. Les binaires (GLB, textures de l'échantillon Sponza, DLL Meta XR) passent par Git LFS dès ce premier commit — les y faire entrer après coup demanderait de réécrire l'historique. Les artefacts régénérés par l'éditeur et par CMake (`Library/`, `.utmp/`, Burst debug) sont ignorés. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3.7 KiB
3.7 KiB
name, description, allowed-tools, tags
| name | description | allowed-tools | tags | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| hz-meta-xr-operator-unity-workflow | Iterates on Unity projects targeting Meta Quest and Horizon OS via the Meta XR Operator MCP server, covering Play Mode gating, scene editing safety, scene hierarchy navigation, UI interaction, and HZDB documentation lookup. |
|
|
Meta XR Operator + Unity Development
Using Meta XR Operator within a Unity + XR Simulator development workflow. Follow the hz-meta-xr-operator skill for general runtime interaction guidance.
The Iteration Loop
- Plan feature/fix (use HZDB for Oculus VR docs if available)
- Modify Unity project (use Unity MCP to edit scripts, scenes, etc.)
- Validate scene in Editor (take editor screenshot for layout understanding)
- Enter Play Mode (app starts, Meta XR Operator becomes available)
- Interact & verify at runtime (use Meta XR Operator MCP tools)
- Exit Play Mode (Meta XR Operator disconnects)
- Repeat from step 2
Critical Rules
- Unity MUST be in Play Mode for Meta XR Operator tools to work. They return errors otherwise.
- Exit Play Mode before making persistent changes to scripts, scenes, or project settings via Unity MCP.
- If Unity MCP becomes unresponsive, Unity is likely compiling code — wait and retry.
Before Entering Play Mode
- Take an editor screenshot to understand the initial layout.
- Query the scene hierarchy via Unity MCP to understand what GameObjects and components exist.
Navigating the Scene Hierarchy
get_scene_root_objects— see top-level objectsget_children("path")— drill down (e.g."Canvas/Panel/StartButton")get_world_pose("path")— get coordinates, then convert to OpenXR (see coordinates skill)
Interacting with UI
find_canvases— locate UI canvasesfind_interactables("CanvasPath")— discover buttons, sliders, etc.get_world_poseon the interactable → convert to OpenXR coordinatesopenxr_set_controller_pose— move controller to that positionopenxr_set_controller_input(Trigger, 1)then(Trigger, 0)— simulate clickopenxr_capture_composited_image— verify
General Unity MCP Tips
- Script types aren't available immediately — after creating C# scripts, Unity needs to compile.
AssetDatabase.Refresh()triggers compilation but disconnects MCP. Wait, then useType.GetType("ClassName, Assembly-CSharp")to add components. - RunCommand can't reference Assembly-CSharp types directly — use
Type.GetType()+AddComponent(type)andSerializedObjectfor wiring references. - Update serialized values in the editor, not just code defaults — public fields are serialized in the scene. Use
Unity_RunCommandwithEditorUtility.SetDirty()to update live values. - Reimport shaders/scripts after editing —
AssetDatabase.ImportAsset(..., ImportAssetOptions.ForceUpdate)andSceneView.RepaintAll().Shader.Find()returns null for unimported shaders. - Reassign shader to material after adding/removing properties to avoid stale bindings.
Colliders & Physics
- Check
isTrigger—OnCollisionEnteronly fires on non-trigger colliders; triggers requireOnTriggerEnter. When in doubt, implement both. - Use
ContinuousDynamicfor fast projectiles — defaultDiscretemode lets fast objects tunnel through colliders. - Never spawn GameObjects from
OnDestroy— Unity calls it during scene teardown. Move spawn logic to the caller.
Using HZDB (if available)
Query HZDB for Oculus VR documentation on VR-specific features (hand tracking, passthrough, spatial anchors, etc.). If unavailable, proceed with general VR knowledge.