View on Asset Store (opens in new tab)
Package details
- Latest version
- 1.0
- Last updated
- First released
- Unity version
- 2022.3.62 or later
- Package size
- 56 KB
- Files
- 41
- Favorites
- 3
- Views in the past week
- 7
Price tracking
- Last checked
- Tracked since
- Lowest recorded
- $7.50 on
Keywords
EventBus Pro - Thread Safe Events
A type-safe, zero-allocation event bus for Unity. Decoupled communication, thread-safe queues, async/await support, and a live editor debugger. Full C# sourcecode.
Affiliate link · Purchases support this site
Price history
Last 6 months
USDAsset preview
1 / 6
EventBus Pro - Thread Safe Events screenshot 1
About this asset
- DEMO -
- DOCS -
_______________
Stop Writing Spaghetti. Start Building Systems.
Every growing Unity project hits the same wall: components calling each other directly, fragile references breaking on prefab changes, and event spaghetti that's impossible to debug. Unity EventBus solves this with a clean, production-ready event-driven architecture that keeps your systems completely decoupled and your codebase maintainable at any scale.
_______________
Why Developers Choose Unity EventBus
Zero Allocation on the Hot Path
Events are structs dispatched through a pre-built snapshot array. No boxing, no per-frame heap allocations, no GC spikes even under thousands of events per second (see the StressTest sample).
Type-Safe by Design
Strongly-typed events via the IEvent interface catch mismatches at compile time, not at runtime.
Thread-Safe Out of the Box
Publish from background threads, Jobs, or async tasks using PublishFromThread or the EventQueue system. Events are buffered and safely dispatched to the main thread every frame, no manual marshalling required.
Async/Await Support
Wait for a specific event without coroutines or polling. Full cancellation token support keeps async flows clean and leak-free.
Automatic Memory Safety
Owner-tracked subscriptions are automatically cleaned up when a MonoBehaviour is garbage-collected.
Live Editor Debugger
The built-in Event Bus Debugger window shows every registered event type, live subscriber counts, and a rolling publish log all in real time. Debug event flow without adding a single line of instrumentation code.
Event Filtering
Subscribe with a predicate to receive only the events that matter to a specific system. Filter by player ID, team, damage type, or any field on the event.
_______________
What's Included
The package ships with a complete runtime system covering the core bus, thread-safe event queues, owner-tracked bindings, and automatic lifecycle management. Editor tools include a live debug window and editor bridge for custom workflows.
Four sample scenes with full source code cover every major use case:
- Basic - publisher/subscriber fundamentals, ideal starting point
- Arena - full gameplay demo with decoupled player, drone, and HUD systems
- StressTest - high-frequency performance validation under heavy event load
- Threaded - safe event dispatch from background threads
_______________
Built for Professionals
Full C# sourcecode. Assembly definitions keep compile times fast and project structure clean. Compatible with Unity 2021.3 LTS through Unity 6. No external dependencies.
From the publisher's Asset Store listing.
Technical details
Zero-Allocation Publish Path
The publish hot path performs a single volatile reference read on a pre-built snapshot array. Events are passed by reference (ref T) so struct data is never copied during dispatch.
Lock-Free Reads, Lock-Protected Writes
Subscribe, Unsubscribe, and the dead-binding sweep are lock-protected and rebuild a stable snapshot array. Publish reads that snapshot with a single atomic volatile read, completely lock-free on the critical path even with concurrent mutations.
Snapshot-Based Dispatch
Subscribers are stored in a sorted snapshot array rebuilt only on mutations. Dispatch iterates the snapshot, meaning subscribe and unsubscribe during publish is safe and takes effect next frame.
Priority Ordering
Each binding carries an integer priority. Higher values fire first within a single Publish call, giving fine-grained control over handler execution order without additional wiring.
Weak-Reference Owner Tracking
Owner-tracked bindings store the subscriber as a WeakReference. The per-frame sweep pass checks liveness and prunes collected bindings automatically.
ConcurrentQueue-Backed Cross-Thread Publish
PublishFromThread enqueues into a ConcurrentQueue<T>, lock-free on the enqueue side. The EventBusLifecycle PlayerLoop injection drains it on the main thread at the top of every Update, before the dead-binding sweep.
PlayerLoop Injection
The lifecycle system uses RuntimeInitializeOnLoadMethod(BeforeSceneLoad) to inject a custom sweep step directly into Unity's PlayerLoop Update phase. No scene object or singleton MonoBehaviour is required.
Filter Predicates Passed by in Reference
Event filters receive the event via an in parameter, a read-only reference with no struct copy. Filters that reject an event incur no handler invocation cost.
One Allocation Per Event Type
Internal delegates are cached as static readonly fields on the generic class, allocated once per event type at first use.
Compatibility
| Unity version | Built-in | URP | HDRP | Custom |
|---|---|---|---|---|
| 6000.0.67f1 | Compatible | Compatible | Compatible | Compatible |
| 2022.3.62f3 | Compatible | Compatible | Compatible | Compatible |
As listed on the Asset Store.