Which pattern do I need?
Describe the problem and get the pattern that fits. Just two quick questions.
What is your problem mostly about?
Which sentence sounds most like your situation?
Which sentence sounds most like your situation?
Which sentence sounds most like your situation?
Which sentence sounds most like your situation?
Which sentence sounds most like your situation?
Which sentence sounds most like your situation?
Which sentence sounds most like your situation?
Our suggestion
Observer
Let one object broadcast changes to any number of listeners without knowing who they are.
The source raises a C# event; UI, audio and achievements subscribe on their own and the source never knows them.
Also worth a look
Our suggestion
Event Bus
A global, typed publish/subscribe hub where publishers and subscribers share only event types, never references to each other.
One typed hub: publishers and subscribers only share event types, never each other.
Also worth a look
Our suggestion
Mediator
Route all communication between peers through one coordinator so they never reference each other.
Peers talk only to one coordinator, which owns the shared rules; N×N references become N.
Also worth a look
Our suggestion
Factory
Hide which concrete class gets created behind a single method that returns an interface.
One Create(id) method returns an interface; callers never name concrete classes again.
Also worth a look
Our suggestion
Type Object
Describe each kind of thing as a data object, so new kinds are assets instead of new subclasses.
Each kind becomes a ScriptableObject asset; new kinds need no code and live tweaks update every instance.
Also worth a look
Our suggestion
Builder
Assemble a complex object one readable step at a time, then hand back the finished product.
A fluent builder collects choices step by step and validates them once in Build().
Also worth a look
Our suggestion
Prototype
Create new objects by copying a configured example instead of building each one from scratch.
Clone a configured example (Instantiate for GameObjects, a deep Clone() for data).
Also worth a look
Our suggestion
Singleton
Guarantee a class has exactly one instance and give everyone a single, well-known way to reach it.
Fastest to wire: a static Instance with duplicate protection. Fine for small projects and jams.
Also worth a look
Our suggestion
State
Give each mode of an object its own class so behaviour changes cleanly when the mode changes.
Each mode becomes a class with Enter/Tick/Exit, and transitions are explicit.
Also worth a look
Our suggestion
Strategy
Swap out an algorithm at runtime by hiding each variant behind a common interface.
Each variant implements one interface and the owner holds whichever it was given.
Also worth a look
Our suggestion
Command
Wrap an action in an object so it can be queued, logged, replayed or undone.
Each action is an object with Execute/Undo that can be stored, queued and replayed.
Also worth a look
Our suggestion
Memento
Capture an object’s state in a sealed snapshot so it can be restored later without exposing its internals.
The object exports an immutable snapshot and restores from it, without exposing its fields.
Also worth a look
Our suggestion
Subclass Sandbox
Give a base class a small toolbox of protected operations and write every subclass only in terms of that toolbox.
A base class offers a small protected toolbox; abilities are written only with it.
Also worth a look
Our suggestion
Component
Build entities by attaching small, single-purpose pieces of behaviour instead of growing a deep inheritance tree.
Small single-purpose components on a GameObject replace the hierarchy; combinations are free.
Also worth a look
Our suggestion
Adapter
Wrap an incompatible API so it looks exactly like the interface your game code already expects.
A thin adapter implements your interface and translates calls to the foreign API.
Also worth a look
Our suggestion
Facade
Give a tangle of subsystems one simple front door so the rest of the game only makes one call.
One method on a facade hides the choreography; callers stay one line long.
Also worth a look
Our suggestion
Dependency Injection
Hand objects the services they need from the outside instead of letting them find or build their own.
Dependencies are passed in through interfaces, so tests can hand in fakes.
Also worth a look
Our suggestion
MVP
Split UI code into a dumb View, a pure-data Model and a Presenter that mediates between them.
A pure-data Model, a dumb View and a Presenter in between: rules become unit-testable.
Also worth a look
Our suggestion
Object Pooling
Recycle a fixed set of objects instead of creating and destroying them, so spawning never stalls the frame.
Reuse a fixed set of objects with Get/Release; after warm-up nothing is allocated.
Also worth a look
Our suggestion
Spatial Partition
Bucket objects by where they are so "what is near me?" only looks at the neighbourhood, not the whole world.
A grid buckets objects by position so queries only scan neighbouring cells.
Also worth a look
Our suggestion
Flyweight
Share the heavy data that many objects have in common, and keep only the small per-object differences on each instance.
Share the heavy intrinsic data once and keep only position/tint per instance.
Also worth a look
Our suggestion
Update Method
Give every entity a per-frame method and let the game loop call it, so each object simulates one frame of its own behaviour.
One manager ticks a list of updatables, with deferred add/remove so the loop stays safe.
Also worth a look