t1k:unity:editor:scene
| Field | Value |
|---|---|
| Module | editor |
| Version | 2.1.7 |
| Effort | medium |
| Tools | — |
Keywords: baker, hierarchy, onvalidate, prefab wiring, scene, scene management, subscene
How to invoke
Section titled “How to invoke”/t1k:unity:editor:scene[demo-name] [--rebuild|--prefabs|--trees|--cache]GameKit Scene — Scene Setup Workflow
Section titled “GameKit Scene — Scene Setup Workflow”Automate the 5-step scene setup pipeline via MCP menu items.
/t1k:unity:editor:scene BattleDemo2D # Full rebuild/t1k:unity:editor:scene --prefabs # Only step 1/t1k:unity:editor:scene --cache # Only clear entity cacheWorkflow
Section titled “Workflow”Step 1: Create Unit Prefabs → execute_menu_item("Tools/{Demo}/Create Unit Prefabs")Step 2: Build BDP Trees → execute_menu_item("Tools/{Demo}/Build Behavior Trees")Step 3: Setup Scene → execute_menu_item("Tools/{Demo}/Setup Scene")Step 4: Clear Entity Cache → execute_menu_item("Tools/{Demo}/Clear Entity Scene Cache") — see "Safe entity-cache clear" belowStep 5: Verify Compilation → read_console(filter: "Error")Safe entity-cache clear (Blocker — destructive op safety)
Section titled “Safe entity-cache clear (Blocker — destructive op safety)”Step 4 historically used raw rm -rf Library/EntityScenes/. Do NOT recommend that. Reasons:
- Wrong CWD (e.g., shell launched from a parent of the Unity project) silently destroys the wrong directory.
- No backup — if something goes wrong mid-bake, the only recovery is
git checkoutof the entireLibrary/(often gitignored). - Bypasses Unity’s editor lock; deleting
Library/EntityScenes/while Unity is open can corrupt the project asset database.
Correct procedure (always):
- Verify CWD is the Unity project root:
[ -d ProjectSettings ] && [ -d Assets ] || { echo "Not a Unity project root"; exit 1; } - Close Unity first (or use the editor menu item below — Unity handles its own locks).
- Prefer the editor menu:
execute_menu_item("Tools/{Demo}/Clear Entity Scene Cache")— the project ships a guarded utility for exactly this. CLI fallback only when no editor session is available. - CLI fallback (only when Unity is closed AND CWD verified):
mv Library/EntityScenes Library/EntityScenes.bak.$(date +%s)— rename, don’t delete. Sweep backups manually after confirming a clean rebuild.
If a step in dots-environment agent code path still emits raw rm -rf, treat it as a bug and patch the agent — never propagate the unsafe pattern.
Demo Menu Paths
Section titled “Demo Menu Paths”| Demo | Menu Path Prefix |
|---|---|
| BattleDemo | Tools/BattleDemo/ |
| BattleDemo2D | Tools/BattleDemo2D/ |
| BattleDemoIso | Tools/BattleDemoIso/ |
| BattleDemoSideView | Tools/BattleDemoSideView/ |
| BackpackCrawler | Tools/BackpackCrawler/ |
| InventoryDemo | Tools/InventoryDemo/ |
Scene setup is THREE steps — wire the prefab refs (Bug C/D safeguards)
Section titled “Scene setup is THREE steps — wire the prefab refs (Bug C/D safeguards)”Create All Prefabs + Setup Scene does NOT auto-populate [SerializeField] GameObject slots on authoring components. Without the wiring step, the SubScene bakes silently with Entity.Null prefabs and the Game view is empty. Apply BOTH safeguards on every new SubScene authoring with a prefab field:
OnValidate()warning on the authoring class (editor-only, skip during Play).- EditMode wiring test (
SerializedObject+FindProperty) asserting every slot is wired in the SubScene asset.
Full recipe + triage checklist: see references/troubleshooting.md → “Silent prefab-wiring + invisible-baker regressions (Bug C / Bug D, 2026-05-18)”.
Auto-Detection
Section titled “Auto-Detection”If no demo specified, detect from recent git changes or CWD.
Agent: dots-environment
Section titled “Agent: dots-environment”References
Section titled “References”references/demo-detection.mdreferences/troubleshooting.md