| name | unity |
| description | Work on a Unity project from the outside: fingerprint the version, write and fix C# MonoBehaviours/ScriptableObjects, run Edit/PlayMode tests and builds through the editor's batchmode CLI, wire CI. Use when the project has ProjectSettings/ProjectVersion.txt or the owner mentions Unity, prefabs, MonoBehaviour, ScriptableObject, or Unity tests. Knowledge-only — no dedicated tools; everything goes through bash_exec and file tools.
|
| version | 1.0.0 |
| author | Remedy |
| tags | ["game","unity","csharp","engine","batchmode","tests"] |
| requires | [] |
| tools | ["game_project_info","local_discover","bash_exec","file_read","file_write","file_edit","repo_search","list_dir","game_playtest","computer_screenshot"] |
| triggers | ["\\b(unity|monobehaviour|prefab|scriptableobject|unity tests?)\\b","\\bc# (script|class) for (a|the|my) game\\b"] |
| local | {"binaries":[{"id":"unity","names":"[Truncated]","env":"[Truncated]"}]} |
Unity (scripts, tests, CI — the editor does the rest)
Most Unity work happens inside the editor GUI: scene layout, prefab wiring,
inspector values. That part cannot be done well from a shell. What can be
done from here is the text and reproducible half: C# scripts, tests,
editor-script builds, CI. When the owner asks for scene work, say so
plainly, do the text half, and tell them exactly what to click.
Fingerprint (start here)
game_project_info(path); then file_read ProjectSettings/ProjectVersion.txt
→ m_EditorVersion: 2022.3.20f1 (exact version the project expects).
Assets/ (all content), Packages/manifest.json (package deps, incl.
com.unity.test-framework, com.unity.inputsystem), ProjectSettings/.
- No
Library/ → project has never been opened on this machine; the first
batchmode run will import everything (minutes, not seconds).
- See
references/project-layout.md for conventions.
Find the editor (never a wizard)
Order: UNITY_EDITOR / UNITY_PATH env → local_discover → PATH → Hub
install dirs: %PROGRAMFILES%\Unity\Hub\Editor\<version>\Editor\Unity.exe
(Windows), /Applications/Unity/Hub/Editor/<version>/Unity.app/Contents/MacOS/Unity,
~/Unity/Hub/Editor/<version>/Editor/Unity (Linux). Match <version> to
m_EditorVersion; a different minor version triggers an upgrade prompt and
may rewrite assets — do not run one without asking.
Not installed? Say so in one line, then still write the C#, tests and
editor scripts. They are valid without an editor; the owner compiles when
they open the project. Do not pretend a test ran.
Batchmode CLI (headless oracle)
Unity.exe -batchmode -nographics -quit -projectPath <p> -executeMethod <Class.Method> -logFile <f>
- Always pass
-logFile <path>; read it afterwards — exit code alone hides
compile errors. Grep for error CS, Exception, Scripts have compiler errors.
- Compile check without doing anything: run with
-quit and no
-executeMethod; a non-zero exit or error CS in the log means broken scripts.
- Budget: imports + domain reload take minutes. Give a long
timeout; never conclude "hung" under 10 minutes on a cold .