Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Advises on choosing Unity design patterns — ScriptableObject, event systems, state machines, object pooling, observer, and more. Use when deciding which pattern fits a problem, structuring decoupled systems, or choosing between event/state-machine/pool approaches, even if the user just asks "用什么模式" or "该用状态机吗". 为选择 Unity 设计模式提供建议(ScriptableObject、事件系统、状态机、对象池、观察者等);当用户要判断哪种模式适合某问题、构建解耦系统、或在事件/状态机/对象池方案间抉择时使用。
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 38% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 0% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 11% | 0% |
| case-07 | ✓→✗ | ▼ Worse | -3% | 0% |
Use this skill to decide whether a pattern is justified. Do not recommend every pattern at once.
> Mode: Documentation only — no REST skills to gate; load freely under any operating mode (Approval / Auto / Bypass).
ScriptableObjectC# events / delegatesGlobal event bus / observer hubInterfacesState machineObject poolService layerGenerics / custom attributesThe Pattern Guide above answers "which pattern?". For most non-trivial design decisions, the better exercise is: pick the 2-3 plausible implementations, put them side by side, and compare on switch cost, query cost, code complexity, and failure modes. Below is a worked example; use it as the shape for other decisions rather than as the answer.
| Implementation | Switch cost (enter/exit cutscene) | Per-frame cost while paused | Code complexity | Failure modes | |----------------|-----------------------------------|----------------------------|-----------------|---------------| | Field flag: each EnemyAI.Update starts with if (_paused) return;; manager sets the flag | O(N) writes, no allocations | N branch tests + dispatch overhead per frame | Lowest — one bool, one guard clause | Silent bugs when a dev adds a new Update and forgets the guard | | enabled = false: manager disables the MonoBehaviour on every enemy | O(N) writes, no allocations | Zero — Unity skips disabled Behaviours in its message list | Low, but state spread across components | OnDisable / OnEnable side effects (coroutines stop, listeners unsubscribe) may fire unexpectedly | | Subset list: manager keeps _active / _frozen lists; no per-enemy Update — manager ticks only _active | O(N) list move on switch | Proportional to _active count only — perfect early-cull | Highest — one source of truth for ownership, requires managed ticking | Adding a new Update on enemies reintroduces per-frame cost; the list is easy to desync if other code respawns enemies directly |
If one option is obviously bounded (N ≤ 10, state changes once per session, or the code runs once at startup), a single paragraph "we picked X because it's simplest" is enough. Decision Lab is for choices that will outlive the current task.
Other measured skills in the registry, with their headline benchmark lift.