unity-patterns

Recommends Unity design patterns for decoupled gameplay architecture decisions.

Updated Jan 29, 2026
One-click install
npx skills add https://github.com/Dylan8865/FinalYearProject --skill unity-patterns-dylan8865
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unity-patterns
Source: https://github.com/Dylan8865/FinalYearProject/tree/main/GameDev/Tester/.agents/skills/unity-skills/skills/patterns
Command: npx skills add https://github.com/Dylan8865/FinalYearProject --skill unity-patterns-dylan8865

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Choosing the wrong design pattern in Unity leads to over-engineered code, hidden coupling, and hard-to-debug systems. This Skill helps you decide whether a pattern like ScriptableObject, a state machine, or an object pool is actually justified for your problem. ## Core Features & Use Cases - Pattern Selection Guidance: Compares ScriptableObject, C# events, event buses, interfaces, state machines, object pools, service layers, and generics with explicit use/avoid criteria. - Decision Lab Method: Provides a side-by-side comparison framework (switch cost, per-frame cost, code complexity, failure modes) for non-trivial design decisions, with a worked example of pausing AI on 100 enemies. - Use Case: You are building an enemy spawning system and wonder whether to use object pooling or plain instantiation. The Skill recommends pooling for frequent spawn/despawn of bullets, VFX, and enemies, while warning against it for rare objects. ## Quick Start Ask the AI which Unity design pattern fits your problem, for example whether you should use a state machine or an event bus for your enemy AI.

Frequently Asked Questions about unity-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I choose the right design pattern in Unity?▼

Compare the 2-3 plausible implementations side by side on switch cost, per-frame cost, code complexity, and failure modes. Recommend at most 1-3 patterns and explain why simpler options like booleans or plain method calls are not enough for your case.

When should I use ScriptableObject in Unity?▼

Use ScriptableObject for authored configuration, shared static data, event channels, and reusable data assets. Avoid it as the default home for per-run mutable gameplay state, where plain class instances are clearer.

Should I use a state machine or booleans for enemy AI?▼

Use a state machine when actors have mutually exclusive states with explicit transitions. If a few booleans or a small command flow covers the behavior, a full state machine adds unnecessary complexity.

When is object pooling worth it in Unity?▼

Object pooling pays off for frequent spawn and despawn of bullets, VFX, enemies, or UI items where instantiation cost matters. Avoid it for rare objects or simple lifetimes, where pooling adds bookkeeping without measurable benefit.

What are the downsides of a global event bus in Unity?▼

A global event bus hides ownership and makes debugging harder when used as the default answer to coupling. Use it sparingly, only when many systems genuinely need broad decoupled notifications; prefer C# events with clear ownership otherwise.