generated from IvanMurzak/Unity-Package-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
Goal
When the user runs Tests / Run, Unity-MCP should ensure Unity is in a compiled, ready state. If scripts changed (or a compile is pending), trigger/await compilation, then run tests. If no compile is needed, run tests immediately.
Acceptance Criteria
- Detect compilation necessity before starting tests:
- scripts were modified since last successful compile, or
- Unity reports compilation is pending/in progress, or
- domain reload is required due to script changes.
- If compilation is required and not already running, trigger a recompile (Unity script compilation refresh).
- If compilation is running, wait until it completes.
- If compilation is not required, run tests immediately (no waiting).
- If compilation was triggered by this action, wait for completion, then run the requested test(s).
- If compilation fails, do not run tests and return a clear error result including:
- compiler errors summary (first N lines) + “see Unity console for full log”
- status = failed
Expected Flow
- AI calls
Tests / Run(optionally with filter / test name). - Tool checks Unity compilation state + whether scripts changed.
- If needed → trigger compile (if not already running) → await compile completion.
- If compile succeeded → run tests.
- Return structured result: compilation step outcome + test run outcome.
Edge Cases
- Compilation is already in progress when command starts → just wait.
- Continuous recompile loops / repeated changes while waiting → debounce and wait for a “stable” successful compile before running tests.
- Entered Play Mode / is playing → decide behavior (block tests or stop play mode) and document it.
Implementation Notes (Unity-side)
- Use Unity’s compilation hooks/state (e.g.,
UnityEditor.Compilation.CompilationPipelineevents +EditorApplication.isCompiling), and only proceed to tests when compilation is finished and successful. - Ensure the tool is resilient to domain reloads (store pending “run tests after compile” intent somewhere that survives reload if needed).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed