Unity Build Commander
Goal
To autonomously execute a Unity build process via the CLI, capture the output logs, parse them for errors, and provide a definitive success/failure report. This allows the agent to verify its own code changes.
When to Use
- •Use when automated builds
- •Use when CI/CD
- •Use when build pipeline
- •Use when custom inspectors
- •Use when editor windows
Constraints
- •Safety: Do not overwrite critical project settings files.
- •Headless: Always run with
-batchmodeand-quitto avoid opening the Unity Editor GUI. - •Logging: Must capture logs to a temporary file or stdout to parse errors.
- •Feedback: If the build fails, you MUST report the specific compiler errors (Filename, Line Number, Error Message).
Procedure
- •Identify Target: Determine the build target (StandaloneWindows64, Android, iOS). Default to Windows if not specified.
- •Execute Build Wrapper: Call the python script
scripts/build_wrapper.py. This script handles the complex Unity CLI arguments and log parsing.- •Command:
python .agent/skills/04-devops-automation/unity-build-commander/scripts/build_wrapper.py --target {target} --output {build_path}
- •Command:
- •Analyze Result: The script will output a JSON object to stdout.
- •If
statusis "success": Report the location of the build. - •If
statusis "failure": List the top 3 errors and ask the user if they want you to fix them.
- •If
Few-Shot Example
User: "Check if the code compiles."
Agent:
- •Infers target:
StandaloneWindows64. - •Runs:
python .../build_wrapper.py --target StandaloneWindows64 --check-only - •Output:
{"status": "failure", "errors": [{"file": "PlayerController.cs", "line": 42, "msg": "; expected"}]} - •Response: "Compilation failed. There is a syntax error in PlayerController.cs at line 42: '; expected'. Shall I fix it?"