event-bus-system

Provide a zero-allocation global event bus for Unity games.

2|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/paek678/BuildUp --skill event-bus-system-paek678
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: event-bus-system
Source: https://github.com/paek678/BuildUp/tree/main/skills/01-architecture/event-bus-system
Command: npx skills add https://github.com/paek678/BuildUp --skill event-bus-system-paek678

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Decoupled global event bus enabling cross-system communication with zero-allocation events to minimize GC spikes during gameplay.

Core Features & Use Cases

  • Static EventBus enabling publish-subscribe style messaging across systems.
  • IEvent marker interface and EventListenerBase<T> to simplify listener lifecycles.
  • Templates and examples to define new events and integrate with UI, gameplay, and analytics.

Quick Start

Define your events as structs implementing IEvent, publish with EventBus.Publish, and subscribe in OnEnable using EventBus.Subscribe, then unsubscribe in OnDisable.

Frequently Asked Questions about event-bus-system

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

FAQPage Schema
How do I set up a zero-allocation event bus in Unity to avoid GC spikes?

To set up a zero-allocation event bus in Unity, define your events as structs implementing the IEvent marker interface, then use the static EventBus class to publish and subscribe. This prevents GC spikes during gameplay.

How does a publish-subscribe pattern help with decoupled cross-system communication in Unity?

A publish-subscribe pattern enables decoupled cross-system communication by allowing gameplay systems to broadcast and react to events without direct references. The EventBus handles routing, ensuring subsystems remain independent.

What is the best way to manage event listener lifecycles in C# gameplay systems?

The best way to manage event listener lifecycles is using EventListenerBase<T>. Subscribe to the EventBus during OnEnable and unsubscribe during OnDisable to safely handle listener creation and cleanup.

Can I use struct-based events for type-safe messaging between UI and gameplay systems?

Yes, you can use struct-based events for type-safe messaging. By implementing the IEvent marker interface on structs, UI, gameplay, and analytics systems can safely publish and subscribe to strongly typed messages.

Why does my Unity game still experience garbage collection spikes during event broadcasting?

Garbage collection spikes during event broadcasting happen when events are allocated as classes rather than structs. Implementing events as structs with a zero-allocation event bus eliminates this memory overhead.

Do I need direct object references to trigger analytics events from gameplay systems?

No, you do not need direct object references to trigger analytics events. A global event bus allows gameplay systems to publish events that analytics subsystems listen to independently without direct references.