Dati negli ScriptableObject, niente in Update senza motivo, un budget di frame per piattaforma.
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.
-
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.
-
Nothing in Update without a reason. A
MonoBehaviourgetsUpdate,LateUpdateorFixedUpdateonly when it must act every frame; everything else reacts to events, coroutines or timers. An empty or pollingUpdatefails the review. -
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.
-
No allocations in the hot path. Per-frame code allocates zero bytes of managed memory: no LINQ, boxing, string building or
GetComponentin loops. The Profiler's GC Alloc column for the gameplay loop reads 0 B in a development build. -
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. -
Physics in FixedUpdate, input in Update. Rigidbody movement happens in
FixedUpdatewith a fixed timestep set in the project; input is read inUpdateand handed over. Moving a Rigidbody by itsTransformfails the review. -
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.
-
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.
-
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.