← Alle Vorlagen

Daten in ScriptableObjects, nichts in Update ohne Grund, ein Frame-Budget pro Plattform.

Constitution — Unity 3D game

Version 1.0.0 · Ratified 2026-11-10

These principles hold for every spec, plan and task of the game. A spec may add rules; it never weakens these.

  1. Data lives in ScriptableObjects. Tuning values, item definitions and level settings are ScriptableObject assets, not literals in MonoBehaviours or fields copied between prefabs. A designer changes a value without touching code.

  2. Nothing in Update without a reason. A MonoBehaviour gets Update, LateUpdate or FixedUpdate only when it must act every frame; everything else reacts to events, coroutines or timers. An empty or polling Update fails the review.

  3. A frame budget per platform. Each target platform has a written frame budget (for example 16.6 ms on console and PC, 33.3 ms on low-end mobile) split between gameplay, rendering and physics. A change that pushes a reference scene over budget in the Profiler is not merged.

  4. No allocations in the hot path. Per-frame code allocates zero bytes of managed memory: no LINQ, boxing, string building or GetComponent in loops. The Profiler's GC Alloc column for the gameplay loop reads 0 B in a development build.

  5. Content loads through Addressables. Scenes, prefabs and large assets are loaded and released through Addressables with labels per level. Nothing big sits in Resources, and every loaded handle is released when its scene unloads.

  6. Physics in FixedUpdate, input in Update. Rigidbody movement happens in FixedUpdate with a fixed timestep set in the project; input is read in Update and handed over. Moving a Rigidbody by its Transform fails the review.

  7. Gameplay logic is testable. Rules that do not need the engine live in plain C# classes with Edit Mode tests in the Unity Test Framework; scene behaviour has Play Mode tests. Both suites run in CI on every merge request.

  8. Assemblies and dependencies are explicit. Code is split into Assembly Definitions per feature so a change recompiles only what depends on it. Assemblies reference each other one way only; a cycle fails the build.

  9. Builds are reproducible. Every platform build is made by a CI script with a pinned Unity version and the same Player Settings, never by hand from an editor. The build number and commit are shown on the title screen.