4.5 KiB
4.5 KiB
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).
- Project type: Unity 2D game remake (see README.md).
- Input stack: Unity Input System package is enabled (see Packages/manifest.json).
First Checks Before Editing
- Read ProjectSettings/ProjectVersion.txt and target that editor version.
- Read Packages/manifest.json for package-provided APIs before introducing new types.
- Do not edit generated folders or files listed in .gitignore.
Linux Build and Test Commands
Set a Unity executable path first (prefer your local Unity Hub install):
UNITY="${UNITY:-/home/$USER/Unity/Hub/Editor/6000.5.6f1/Editor/Unity}"
PROJECT="/home/mse/Documentos/Unity Projects/Barrack Unity"
Open project:
"$UNITY" -projectPath "$PROJECT"
Batch build (Linux player):
"$UNITY" \
-batchmode -quit \
-projectPath "$PROJECT" \
-buildTarget StandaloneLinux64 \
-buildLinux64Player "$PROJECT/Build/Barrack.x86_64" \
-logFile "$PROJECT/Logs/build.log"
EditMode tests:
"$UNITY" \
-batchmode -quit \
-projectPath "$PROJECT" \
-runTests -testPlatform EditMode \
-testResults "$PROJECT/test-results-editmode.xml" \
-logFile "$PROJECT/Logs/tests-editmode.log"
PlayMode tests:
"$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 as source of truth; Unity regenerates it.
Key Code Areas
- Assets/Scripts/Game: gameplay loop, board, filling logic, UI, level flow.
- Assets/Scripts/Game/Balls: ball hierarchy and shared physics behavior.
- Assets/Scripts/Game/Player: player movement, bars, laser behavior.
- Assets/Scripts/Game/Spawners: timed entity spawners.
- Assets/Scripts/Game/Yummies: collectibles and rewards.
- Assets/Scripts/MainMenu: menu flow and scene loading.
- 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, andIEnumeratorusage. - Prefer existing Input System patterns over legacy
InputAPIs.
Unity Safety Rules
- Preserve
.metafiles 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),
- animator states/triggers/bools,
Resources.Loadpaths (for example in Assets/Scripts/Game/GameBoard.cs).
- Current scene build order lives in ProjectSettings/EditorBuildSettings.asset.
Common Failure Patterns (Seen In Prior Sessions)
- Missing Inspector references leading to
NullReferenceExceptionat 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.