AGENTS.md Generator for Unity & Unreal
Pick the engine, features, platforms and genre: get an AGENTS.md that tells Claude Code, Codex, Cursor, Copilot or Gemini how to work in your game project without breaking .meta files, Blueprints or the build.
How to use
- Start from a template (PC, mobile 2D, multiplayer, VR, DOTS, Unreal shooter, open world, Blueprint indie, game jam) or set the engine yourself.
- Tick the engine features you use: render pipeline, Input System, Addressables, DOTS, netcode; or Enhanced Input, GAS, replication, World Partition, CommonUI.
- Choose platforms, genre, project stage and version control, add your own project rules.
- Copy each file or download all of them as a ZIP and put them in the repository root.
What goes into the file
Only rules that change what an agent does in a game project: which folders are generated and must never be edited (Library, Temp, Binaries, Intermediate, Saved), that .meta files, scenes, prefabs and .uasset files are not hand-edited, how to run tests headless, engine code conventions, and rules for networking, streaming or mobile budgets when they apply.
Keep the file short. Agents treat it as context, not as enforcement, and follow a focused file better than a long one; move anything that must never happen into hooks or CI checks.
# AGENTS.md - MyGame Instructions for AI coding agents working in this repository. The closest AGENTS.md to the edited file wins; explicit instructions in the chat override this file. ## Project MyGame is a game for PC (Windows). Stack: Unity 6000.0 (exact version in `ProjectSettings/ProjectVersion.txt`), URP, Input System package, uGUI. Production: changes ship to players; keep the build green and the diff reviewable. ## Repository layout - `Assets/` - game content and scripts (edit here). - `Packages/manifest.json`, `Packages/packages-lock.json` - package versions (source-controlled). - `ProjectSettings/` - project settings (source-controlled; change only when the task asks). - Never edit or commit `Library/`, `Temp/`, `Obj/`, `Logs/`, `UserSettings/`, `Build/`, generated `*.csproj` / `*.sln`. ## Build and test ```sh # EditMode tests (results are NUnit XML; check failures in the file, not only the exit code) "Unity" -batchmode -nographics -projectPath . -runTests -testPlatform EditMode -testResults TestResults/editmode.xml -logFile - # PlayMode tests "Unity" -batchmode -projectPath . -runTests -testPlatform PlayMode -testResults TestResults/playmode.xml -logFile - # Player build through the project build script "Unity" -batchmode -nographics -quit -projectPath . -executeMethod BuildScript.Build -logFile - ``` - The Editor cannot open the same project twice: close it (or ask the user to) before batchmode runs. - `BuildScript.Build` is a placeholder: point it at the project's own static build method in an `Editor/` folder. - Filter tests with `-testFilter "Namespace.Class"` or `-assemblyNames "Game.Tests"`. ## Code style - C#: PascalCase types and methods, camelCase locals, `_camelCase` private fields; one public type per file, file named after it. - Expose inspector fields as `[SerializeField] private`, not `public` fields. - Cache component references in `Awake`; no `GetComponent`, `Find*`, LINQ or allocations in `Update` / `FixedUpdate` / `LateUpdate`. - Subscribe in `OnEnable`, unsubscribe in `OnDisable`. - Use `CompareTag`, not `tag ==`. Remember `UnityEngine.Object` overrides `==`: do not use `?.` / `??` on Unity objects. - Data and tuning go into ScriptableObjects, not hard-coded constants. - Editor-only code lives in `Editor/` folders or an Editor-only asmdef; wrap other editor calls in `#if UNITY_EDITOR`. - Each feature folder has an `.asmdef`; tests sit in their own asmdef referencing the code under test. - Unity 6: prefer `Awaitable` / async methods over new coroutines for async flows. ## Assets, scenes and serialization - Every asset has a `.meta` file with its GUID. Never delete, regenerate or hand-edit `.meta` files; move or rename an asset together with its `.meta`. - Scenes, prefabs, materials and `.asset` files are Unity YAML: do not hand-edit them. Describe the change for the user, or make it through an editor script. - Asset serialization must stay "Force Text" and meta files "Visible Meta Files". - Do not upgrade the Unity version or packages, or switch the render pipeline, unless the task asks. ## Engine features in use - URP: use URP/Lit or Shader Graph shaders; no Built-in-only shaders or `OnRenderImage`; post effects go through Volumes / Renderer Features. - Input goes through Input Action assets (`PlayerInput` or generated C# class); no `UnityEngine.Input` calls. ## Version control - Git with LFS: binary assets (textures, audio, models, video) are LFS-tracked through `.gitattributes`; do not add binaries outside those patterns. - Merge conflicts in scenes or prefabs are resolved with UnityYAMLMerge (Smart Merge), never by hand-editing the YAML. - Commit only source and assets you changed; never commit generated folders. ## Working rules for agents - Read the code you change and its callers first; keep diffs small and focused on the task. - Run the tests above before calling a change done; add a test for new logic that does not need a scene or level. - Ask before: deleting files or assets, upgrading the engine or packages/plugins, changing project settings, or adding a dependency. - Production: no placeholder or debug code left in shipping paths; log through the project logger, not `Debug.Log` spam. - If you cannot run the editor or tests in this environment, say exactly what was not verified.
72 lines · Keep AGENTS.md short: agents follow a focused file better than a long one.
FAQ
- What is AGENTS.md?
- A plain Markdown file at the repository root with instructions for AI coding agents: project overview, build and test commands, code style and rules. Codex, Cursor, Copilot, Gemini CLI, Jules, Zed, Aider and others read it; the closest AGENTS.md to the edited file wins.
- Why also CLAUDE.md, Cursor and Copilot files?
- Some agents read their own file first. The generated CLAUDE.md and GEMINI.md import AGENTS.md with @AGENTS.md, the Cursor rule is scoped to code files with globs, and copilot-instructions.md repeats the key rules for Copilot code review. AGENTS.md stays the single source of truth.
- Are the build and test commands ready to run?
- They follow the Unity Test Framework command line and Unreal's UnrealEditor-Cmd / Build.bat / RunUAT conventions. Replace the editor path, <UE> and <abs path> placeholders and point BuildScript.Build at your own build method.
- Does the tool send my settings anywhere?
- No. Files are generated in your browser; settings are kept in local storage and only leave the page if you copy a share link.
Related tools
-
Unity Screen Flow Scaffolder
Menus/HUD presets → flow diagram, screens.json, UXML or UGUI notes, UIScreenRouter stub — export bundle.
-
Settings Menu & Persistence Generator
Categories, PlayerPrefs/JSON/SO — schema, keys registry, storage stub, migration notes, UXML outline.
-
UI Toolkit Runtime Binding Scaffolder
Field list → ViewModel, Binder, UXML placeholders, BindingNotes.md for Unity 6 runtime binding.
-
Animation Event Bus & Marker Scaffold
Footsteps, hit frames, VFX... → AnimationEventId enum, bus + receiver stubs, marker naming guide.
-
Dialogue Graph Bootstrap Generator
VN/RPG/barks → dialogue-schema.json, C# node/runner stubs, sample YAML, localization key plan.
-
Unity Project Template & Folder Convention Generator
Game type, repo, UI stack → FolderTree.txt, CONVENTIONS.md, .gitignore starter, packages list.