[Feature] Auto-Fixing Playtest
Agentic QA Loop: Core Capabilities
- Active Interception The "Sensory System" for the AI.
Core Logic: Enables the AI to detect game crashes or logic errors even without a user monitoring the screen.
Technical Implementation:
Global Listener: Subscribes to the Application.logMessageReceived event.
Exception Filtering: Targets LogType.Exception (crashes), LogType.Error (logic errors), and UnityEngine.Assertions (assertion failures).
Context Snapshot: Upon error, the system records the Stack Trace along with the current Scene State (selected objects, variable values) to provide "evidence" for the AI.
- Sampling-based Self-healing The "Decision Center" implemented via FastMCP.
Core Logic: By utilizing ctx.sample(), the AI shifts from a passive responder to an active "mechanic" summoned by Unity.
Workflow:
Unity captures an error (e.g., NullReferenceException).
unity-mcp packages the error message, relevant source code, and line numbers, then initiates a sampling/createMessage request.
Claude (Client) receives the request. With context awareness, it identifies the cause (e.g., "Deleting a component reference caused this error").
Patch Generation: AI generates the fixed C# code block.
- Validation Loop The "Logical Conclusion" of the process.
Core Logic: Ensures fixed code is re-verified until the test case (Playback) passes completely.
Automation Chain:
AI provides the fix -> unity-mcp calls manage_script to apply changes -> Triggers Unity auto-compilation.
Once compiled, the system automatically restarts Play Mode and reruns the Action Playback (Step 1).
Termination Condition: If all recorded actions complete with a clean Console, it reports "Fix Successful." If errors persist, the AI receives a new stack trace and enters the next iteration.