From 683cfdcc9fb44442639d90472675661169bfaa5a Mon Sep 17 00:00:00 2001 From: Miguel Astor Date: Thu, 27 Aug 2026 12:06:47 -0400 Subject: [PATCH] TO SQUASH: Agents.md --- AGENTS.md | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..a6f84d3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,115 @@ +# AGENTS + +This file gives AI coding agents the minimum project context needed to work safely and productively in this Unity repository. + +## Project Snapshot + +- Unity editor version: 6000.5.6f1 (see [ProjectSettings/ProjectVersion.txt](ProjectSettings/ProjectVersion.txt)). +- Project type: Unity 2D game remake (see [README.md](README.md)). +- Input stack: Unity Input System package is enabled (see [Packages/manifest.json](Packages/manifest.json)). + +## First Checks Before Editing + +1. Read [ProjectSettings/ProjectVersion.txt](ProjectSettings/ProjectVersion.txt) and target that editor version. +2. Read [Packages/manifest.json](Packages/manifest.json) for package-provided APIs before introducing new types. +3. Do not edit generated folders or files listed in [.gitignore](.gitignore). + +## Linux Build and Test Commands + +Set a Unity executable path first (prefer your local Unity Hub install): + +```bash +UNITY="${UNITY:-/home/$USER/Unity/Hub/Editor/6000.5.6f1/Editor/Unity}" +PROJECT="/home/mse/Documentos/Unity Projects/Barrack Unity" +``` + +Open project: + +```bash +"$UNITY" -projectPath "$PROJECT" +``` + +Batch build (Linux player): + +```bash +"$UNITY" \ + -batchmode -quit \ + -projectPath "$PROJECT" \ + -buildTarget StandaloneLinux64 \ + -buildLinux64Player "$PROJECT/Build/Barrack.x86_64" \ + -logFile "$PROJECT/Logs/build.log" +``` + +EditMode tests: + +```bash +"$UNITY" \ + -batchmode -quit \ + -projectPath "$PROJECT" \ + -runTests -testPlatform EditMode \ + -testResults "$PROJECT/test-results-editmode.xml" \ + -logFile "$PROJECT/Logs/tests-editmode.log" +``` + +PlayMode tests: + +```bash +"$UNITY" \ + -batchmode -quit \ + -projectPath "$PROJECT" \ + -runTests -testPlatform PlayMode \ + -testResults "$PROJECT/test-results-playmode.xml" \ + -logFile "$PROJECT/Logs/tests-playmode.log" +``` + +Notes: +- If no tests exist yet, test runs may complete with zero tests. +- Do not treat [Assembly-CSharp.csproj](Assembly-CSharp.csproj) as source of truth; Unity regenerates it. + +## Key Code Areas + +- [Assets/Scripts/Game](Assets/Scripts/Game): gameplay loop, board, filling logic, UI, level flow. +- [Assets/Scripts/Game/Balls](Assets/Scripts/Game/Balls): ball hierarchy and shared physics behavior. +- [Assets/Scripts/Game/Player](Assets/Scripts/Game/Player): player movement, bars, laser behavior. +- [Assets/Scripts/Game/Spawners](Assets/Scripts/Game/Spawners): timed entity spawners. +- [Assets/Scripts/Game/Yummies](Assets/Scripts/Game/Yummies): collectibles and rewards. +- [Assets/Scripts/MainMenu](Assets/Scripts/MainMenu): menu flow and scene loading. +- [Assets/Scripts/Utils](Assets/Scripts/Utils): reusable helpers. + +## Project Conventions + +- One class per file; class name matches file name. +- No namespaces in project scripts. +- PascalCase for classes/methods; camelCase for fields/locals. +- Many Inspector-assigned dependencies are public fields. +- Lifecycle and coroutine patterns follow standard Unity `Start`, `Update`, `FixedUpdate`, and `IEnumerator` usage. +- Prefer existing Input System patterns over legacy `Input` APIs. + +## Unity Safety Rules + +- Preserve `.meta` files and GUIDs when moving/renaming assets. +- Treat scenes and prefabs as serialized contracts: renaming serialized fields, components, tags, or animator parameters can silently break references. +- Keep runtime string contracts in sync: + - scene names (for example in [Assets/Scripts/MainMenu/MenuCallbackHolder.cs](Assets/Scripts/MainMenu/MenuCallbackHolder.cs)), + - animator states/triggers/bools, + - `Resources.Load` paths (for example in [Assets/Scripts/Game/GameBoard.cs](Assets/Scripts/Game/GameBoard.cs)). +- Current scene build order lives in [ProjectSettings/EditorBuildSettings.asset](ProjectSettings/EditorBuildSettings.asset). + +## Common Failure Patterns (Seen In Prior Sessions) + +- Missing Inspector references leading to `NullReferenceException` at runtime. +- Animator transition or trigger mismatches causing entities to remain in wrong states. +- Type/namespace mismatches when using package APIs. + +When adding fields or animator parameters, include defensive null checks and keep names synchronized with scene/prefab/controller data. + +## Useful References + +- [README.md](README.md) +- [ProjectSettings/ProjectVersion.txt](ProjectSettings/ProjectVersion.txt) +- [Packages/manifest.json](Packages/manifest.json) +- [Packages/packages-lock.json](Packages/packages-lock.json) +- [ProjectSettings/EditorBuildSettings.asset](ProjectSettings/EditorBuildSettings.asset) +- [Assets/InputSystem_Actions.inputactions](Assets/InputSystem_Actions.inputactions) +- [.vscode/launch.json](.vscode/launch.json) +- [.gitignore](.gitignore) \ No newline at end of file