Генератор AGENTS.md для Unity и Unreal

Выберите движок, фичи, платформы и жанр - и получите AGENTS.md, который объясняет Claude Code, Codex, Cursor, Copilot или Gemini, как работать в игровом проекте и не ломать .meta-файлы, Blueprints и сборку.

Как пользоваться

  1. Начните с шаблона (PC, мобильная 2D, мультиплеер, VR, DOTS, шутер на Unreal, открытый мир, инди на Blueprints, геймджем) или выберите движок сами.
  2. Отметьте фичи движка: рендер-пайплайн, Input System, Addressables, DOTS, сетевой код; или Enhanced Input, GAS, репликацию, World Partition, CommonUI.
  3. Выберите платформы, жанр, стадию проекта и контроль версий, добавьте свои правила.
  4. Скопируйте файлы по одному или скачайте все одним ZIP и положите в корень репозитория.

Что попадает в файл

Только правила, которые меняют поведение агента в игровом проекте: какие папки генерируются и их нельзя трогать (Library, Temp, Binaries, Intermediate, Saved), что .meta-файлы, сцены, префабы и .uasset не правятся руками, как запускать тесты без интерфейса, соглашения по коду движка и правила для сети, стриминга мира или мобильных бюджетов, если они нужны.

Держите файл коротким. Агенты воспринимают его как контекст, а не как жёсткий запрет, и лучше следуют компактному файлу; то, что не должно случиться никогда, выносите в хуки или проверки CI.

Движок
Платформы
Настройки Unity
Дополнительно сгенерировать
# 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 строк · Держите AGENTS.md коротким: агенты лучше следуют компактному файлу.

Вопросы и ответы

Что такое AGENTS.md?
Обычный Markdown-файл в корне репозитория с инструкциями для AI-агентов: описание проекта, команды сборки и тестов, стиль кода и правила. Его читают Codex, Cursor, Copilot, Gemini CLI, Jules, Zed, Aider и другие; действует ближайший к изменяемому файлу AGENTS.md.
Зачем ещё CLAUDE.md, Cursor и Copilot?
Некоторые агенты сначала читают свой файл. Сгенерированные CLAUDE.md и GEMINI.md подключают AGENTS.md через @AGENTS.md, правило Cursor ограничено файлами кода через globs, а copilot-instructions.md повторяет ключевые правила для ревью Copilot. Источник правды один - AGENTS.md.
Команды сборки и тестов готовы к запуску?
Они следуют командной строке Unity Test Framework и соглашениям Unreal (UnrealEditor-Cmd, Build.bat, RunUAT). Замените путь к редактору и заглушки <UE> и <abs path>, а BuildScript.Build направьте на свой метод сборки.
Настройки куда-то отправляются?
Нет. Файлы создаются в браузере, настройки хранятся локально и покидают страницу только если вы скопируете ссылку.