Your First Debugging Session
This is a worked example of a complete Theatre debugging session. We will find and fix a real bug — an enemy that sometimes fails to detect the player — using Spectator's spatial tools with Claude Code.
The setup
You have a 3D game with:
- A
CharacterBody3DnamedPlayerwith a movement script - An
Area3DnamedEnemyDetectionZoneattached to an enemy, set to trigger enemy alert - The bug: enemy sometimes does not alert when the player walks directly in front of it
You have already tried reading the detection script and the collision layer settings. The code looks correct. You need to see what is actually happening at runtime.
Step 1: Start a recording session
Click the Start Recording button in the Spectator dock to begin recording.
Walk the player in front of the enemy a few times. On the third or fourth pass, the enemy fails to detect you — you see the player enters the zone visually but the alert animation does not play.
Press F9 to mark this as a bug moment (the dock shows "Bug marker set at frame 312"). Click the Stop Recording button in the Spectator dock.
Step 2: Ask the agent to analyze the clip
Step 3: The agent finds the anomaly
Step 4: Verify the diagnosis
Step 5: Fix it with Director
Step 6: Verify the fix
Press F5 to run the game with the fix applied. Walk the player in front of the enemy. The alert triggers every time.
To confirm with the agent:
What made this work
Without Theatre, this bug would have required:
- Adding
print()statements to the detection script - Re-running the game
- Staring at console output and manually correlating frame numbers
- Guessing that the issue was collision layers rather than the detection logic
- Checking the collision layer settings manually in the inspector
With Theatre:
- Record the bug happening
- Agent queries the spatial recording around the marked frame
- Agent compares positions and inspects properties — finds the mismatch in < 60 seconds
- Agent fixes it via Director without hand-editing the scene file
The key insight — that the collision_mask was wrong — came from the agent reading the actual runtime property values, not from reading the code. The code was correct; the configuration was wrong.
Patterns to take away
Mark bug moments with F9. Precise markers let the agent narrow its analysis to a small frame window instead of searching hundreds of frames.
Use spatial_inspect after clips to get property values at a specific moment. The clip recording captures position and velocity; inspect gives you the full property set.
Let the agent compare two nodes. Most spatial bugs are relational — wrong distance, wrong layer, wrong parent. Give the agent both nodes and ask it to compare.
Use Director to fix without leaving the agent. The full loop — observe, diagnose, fix, verify — happens inside your AI agent session without manually touching the editor.