unity-batchmode
/unity-batchmode
Runs Unity without the editor UI - EditMode and PlayMode tests, player builds through a build script with a proper exit code, and compile checks - and reads the Unity log to report errors. Use when the user wants to build a Unity game from the terminal or CI, run Unity Test Framework tests headless, check whether C# scripts compile after an edit, or set up GitHub Actions for Unity.
- Author
- flxnsee ↗
- Repository
- gamedev-toolkit ↗
- Licence
- MIT
- Last repository change
- 05.11.2026
Assessment and security
- Files in this package
- 2
- Scripts
- 1
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 05.11.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 1 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: assets/BuildScript.cs
What it does and when to use it
Runs Unity without the editor UI - EditMode and PlayMode tests, player builds through a build script with a proper exit code, and compile checks - and reads the Unity log to report errors. Use when the user wants to build a Unity game from the terminal or CI, run Unity Test Framework tests headless, check whether C# scripts compile after an edit, or set up GitHub Actions for Unity.
Original author description
Runs Unity without the editor UI - EditMode and PlayMode tests, player builds through a build script with a proper exit code, and compile checks - and reads the Unity log to report errors. Use when the user wants to build a Unity game from the terminal or CI, run Unity Test Framework tests headless, check whether C# scripts compile after an edit, or set up GitHub Actions for Unity.
How it works
- Find the editor
- Commands
- Build script
- Reading the log
- CI
SKILL.md preview
--- name: unity-batchmode description: Runs Unity without the editor UI - EditMode and PlayMode tests, player builds through a build script with a proper exit code, and compile checks - and reads the Unity log to report errors. Use when the user wants to build a Unity game from the terminal or CI, run Unity Test Framework tests headless, check whether C# scripts compile after an edit, or set up GitHub Actions for Unity. license: MIT compatibility: Unity 2021.3+ (tested commands are the same in Unity 6). A Unity license must be activated on the machine. metadata: author: gamedev-toolkit version: "0.1.0" --- # Unity batchmode ## Find the editor The project's version is in `ProjectSettings/ProjectVersion.txt` (`m_EditorVersion`). Use exactly that version from Unity Hub's install folder: - Windows: `C:\Program Files\Unity\Hub\Editor\<version>\Editor\Unity.exe` - macOS: `/Applications/Unity/Hub/Editor/<version>/Unity.app/Contents/MacOS/Unity` - Linux: `~/Unity/Hub/Editor/<version>/Editor/Unity` **The project must not be open in the editor**: Unity locks it, and batchmode fails with "It looks like another Unity instance is running with this project open." Ask the user to close it. ## Commands Always pass `-logFile <file>` and read it afterwards. The exit code alone hides the reason. | Task | Command (append `-projectPath <dir> -logFile <file>`) | | --- | --- | | Compile check (import + compile, then quit) | `Unity -batchmode -nographics -quit` | | EditMode tests | `Unity -batchmode -nographics -runTests -testPlatform EditMode -testResults results-edit.xml` | | PlayMode tests | `Unity -batchmode -runTests -testPlatform PlayMode -testResults results-play.xml` | | Build via script | `Unity -batchmode -nographics -quit -executeMethod GamedevToolkit.BuildScript.BuildFromCommandLine -buildTarget Win64 -target StandaloneWindows64 -out Builds/Win/Game.exe` | Notes: - **Don't pass `-quit` with `-runTests`**: the test runner quits by itself, and `-quit` can stop it before the tests run. - `-nographics` breaks PlayMode tests that render or use GPU features. Drop it for those. - `-testResults` writes NUnit XML. Count `<test-case ... result="Failed">` elements and report each failure's `<message>`. - Filter tests with `-testFilter "Namespace.Class.Method"` or `-testCategory "Fast"`. ## Build script Copy [assets/BuildScript.cs](assets/BuildScript.cs) to `Assets/Editor/BuildScript.cs` (it must be in an `Editor` folder). It reads `-target` (a `BuildTarget` enum name such as `StandaloneWindows64`, `StandaloneLinux64`, `Android`, `WebGL`) and `-out`, builds every scene enabled in Build Settings, and exits with code 1 on failure, so CI fails properly. ## Reading the log Search the log file for, in order: 1. `error CS` — C# compile errors (file, line, message). Fix these first; nothing else runs. 2. `Scripts have compiler errors.` — confirms the build stopped at compilation. 3. `Build Finished, Result: Failed` / `Error building Player` — build failures. 4. `Exception` — runtime errors in editor scripts. 5. `[Licensing]` — license or activation problems (common in CI). Report the first real error with its file and line, not the whole log. ## CI For GitHub Actions the community **GameCI** actions (`game-ci/unity-test-runner`, `game-ci/unity-builder`) handle Docker images and license activation. They need the `UNITY_LICENSE` (or `UNITY_SERIAL` for Pro), `UNITY_EMAIL` and `UNITY_PASSWORD` repository secrets. Point the user to game.ci's activation docs for their license type. Never put credentials in the workflow file.
Files in this package (2)
- SKILL.md 4 KB
- assets/BuildScript.cs 3 KB
Versions
The database has no other skills named unity-batchmode.
Database snapshot: 13.11.2026 · package version acedeb154ca7 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100unity-tests-write
Use when writing Unity tests, including EditMode tests, PlayMode tests, performance testing, and code coverage - 100unity-testing
Unity test rules. Use when writing, choosing or reviewing Unity tests, setting up a test assembly, choosing EditMode or PlayMode, sketching test seams for Unity code, or when a Unity test fails in a way plain C# would not. - 95uloop-run-tests
Run Unity Test Runner and report detailed results. Use for EditMode/PlayMode tests or failure diagnosis; for runtime behavior the tests do not exercise, use pause-point (trace) or record-video. - 100unity-testing
Unity Test Framework — EditMode + PlayMode tests, [UnityTest] coroutines, Test Runner, mocking patterns, Unity.PerformanceTesting package. USE WHEN: writing/debugging tests, setting up CI test runs, performance regression tests, asserting scene state, mocking time/input. DO NOT… - 95uloop-run-tests
Run Unity Test Runner and report detailed results. Use for EditMode/PlayMode tests or failure diagnosis; for runtime behavior the tests do not exercise, use pause-point (trace) or record-video. - 100unity-run
Use when running Unity from CLI for any purpose — builds, tests, method execution, asset imports. Handles Unity installation detection, batchmode execution, and log monitoring. Other unity-dev skills depend on this for CLI execution.