Overview
Eleven design patterns, each built as a playable Unity demo.
Solo · every pattern, every demo
A teaching repository. Each pattern lives on its own branch and ships as a playable Unity scene with its own art and GUI, rather than as a code listing.
The demos are built around concrete game scenarios instead of abstract shapes, and each one carries the auxiliary classes that connect the pattern's core logic to Unity's GUI layer, which is the seam where examples like these usually break down.
It is the most-used thing I have put on GitHub, starred and forked by other developers as a reference, and it carries the only external pull request merged across any of my repositories.
My contributions
Strategy
Each character's behaviour lives in its own strategy class behind one interface, and the handler simply runs whichever it is given. A new character is a new class, never a new branch.
Chain of Responsibility
A chat filter passes every message down a chain of rules, and any link can approve or reject it. New rules join the chain without touching the ones already in place.
Singleton
An audio mixer that refuses to double up: one instance, globally reachable, owning the sound state. This clip keeps its audio so you can hear it working.
Factory Method
Creation moves behind one interface: callers ask for a product and never name a concrete class, so new variants ship without editing a single call site.
Abstract Factory
A sushi kitchen where each factory produces a whole family of related dishes. Swapping the factory swaps the family, and the kitchen code never changes.
Builder
An airship assembled step by step through a GUI. The builder runs the steps in order and hands over the finished vehicle, keeping construction separate from representation.
Prototype
A monster horde grown by cloning: each copy starts from an original and keeps its state, damage included, so spawning is copying rather than rebuilding.
Adapter
Two colour systems, RGB and hex, made to work together through an adapter that translates one interface into the other without changing either side.
Bridge
Character control split from character implementation, so either side varies alone: new controls need no new characters, and new characters need no new controls.
Composite
A recursive loot box built on ScriptableObjects: a box can hold items or further boxes, and one call opens the whole tree.
Decorator
A shop inventory that gains enhancements at runtime: each decorator wraps the item and adds its effect, stacking freely with no subclass explosion.
How it is structured
- Developed each pattern on its own branch and merged the ones I considered finished, so the repository doubles as a record of which are complete.
- Built every pattern as a playable Unity scene rather than a code listing, with its own art package and GUI.
- Grounded each demo in a concrete game scenario instead of abstract shapes, and wrote the auxiliary classes connecting the pattern's core logic to Unity's GUI layer, which is the seam where examples like these usually break down.
Supporting systems
- Built a ScriptableVariable system covering bool, float and int, with a binding that puts a scriptable value straight onto on-screen text.
- Built a flexible grid layout component and DOTween feedback so the demos behave like games rather than like tests.
- Kept a hotfix branch for the unglamorous half: scene fixes, naming, descriptions and a UI scale problem in free-aspect game view.
Project details
- Studio
- Solo
- Genre
- Reference Project
- Engine
- Unity
- Stack
- Unity · C# · Design Patterns · OOP · Scriptable Objects · DOTween · Reference




