View on Asset Store (opens in new tab)
Package details
- Latest version
- 1.3.1
- Last updated
- First released
- Unity version
- 2022.3.62 or later
- Package size
- 384 KB
- Files
- 92
- Favorites
- 13
- Views in the past week
- 19
Price tracking
- Last checked
- Tracked since
- Lowest recorded
- Free on
Keywords
Spoke - Reactive Framework
Spoke is a reactive framework for C# and Unity. Inspired by React, but targeting the needs of game-logic, it's built to tame the chaos when many systems interact in dynamic, emergent ways.
Affiliate link · Purchases support this site
Price history
Last 6 months
USDAsset preview
1 / 6
Spoke - Reactive Framework screenshot 1
About this asset
Spoke is a reactive framework for Unity. It turns tangled event-driven logic into clear, composable code that reads top to bottom.
What problem does it solve?
Games are full of long-lived behaviours, logic that starts on one frame and must be undone on a later frame:
- OnEnable / OnDisable
- Awake / OnDestroy
- OnEnemyDetected / OnEnemyLost
Sometimes they're wired up with events, sometimes with polling and diff-checking in Update(). Either way, the setup/teardown symmetry is maintained by hand, and bugs slip through. For example, an enemy is destroyed while shooting its laser beam, and the beam is left hanging in the scene because nothing cleaned it up.
Spoke replaces the hand-wiring with signal-based reactivity, inspired by frontend frameworks like React and SolidJS. Game state lives in signals. Effects read signals, and re-run when they change. Before each re-run the effect cleans up after itself, so setup, reaction and cleanup live together in one block of code.
Effects nest into a tree of lifetimes. The laser beam from earlier becomes: while the enemy is alive, and while it's firing, show the beam. If the enemy dies mid-beam, the beam goes with it. That's two levels of nesting, and your code stays just as clear at many more.
When state changes, the affected subtree is rebuilt: stale behaviour is torn down in reverse setup order, and fresh behaviour is set up in its place.
What's inside?
Spoke is a toolbox of composable reactive primitives:
- State: a reactive value. Read it, set it, subscribe to it
- Trigger: a reactive event. Fire it, subscribe to it
- Effect / Phase / Reaction: self-cleaning blocks of logic that re-run when a value they read changes
- Memo: a computed value, recalculated when its inputs change
- Dock: attach and remove blocks dynamically, by key
How does it fit into Unity?
- Subclass SpokeBehaviour instead of MonoBehaviour. Awake, OnEnable, Start, OnDisable and OnDestroy collapse into one Init block
- UState is a reactive value that serializes, shows in the Inspector, and plays nice with Undo
- Deterministic app and scene teardown, so destruction-order exceptions stop haunting you
- Adopt it in one script, one system, or a whole project
How does it perform?
Spoke was born inside a VR immersive sim running on the Meta Quest. It manages lifecycles, not per-frame work, so it stays off the hot path. State updates and effect re-runs allocate zero GC; allocations only happen when new subtrees are built.
It's around 2,800 lines of plain C#. No dependencies, unit-tested, MIT. The core has no Unity dependency, so it works in any C# app.
The Performance doc covers this in more detail.
Getting Started
Read the QuickStart guide.
There's also Base Defence, a complete tower defence game written entirely in Spoke.
Spoke is free and open source. You can find the GitHub repo here.
From the publisher's Asset Store listing.
Technical details
Features
Declarative reactivity framework for general purpose logic
Supported OS
All
Link to documentation
Compatibility
| Unity version | Built-in | URP | HDRP | Custom |
|---|---|---|---|---|
| 2022.3.62f1 | Compatible | Compatible | Compatible | Compatible |
As listed on the Asset Store.