mcpField
U
unity-event-bus

unity-event-bus

github.com/muharremtozanDevelopment1756 installsUpdated 22w ago
Repository

About unity-event-bus

unity-event-bus is a skill providing a type-safe messaging hub for Unity developers who want to decouple systems. It uses generic event dispatch and automatic initialization, with safeguards for Editor Play Mode.

Key features

  1. 01Automatically discover and initialize events
  2. 02O(1) generic event dispatch
  3. 03Avoid runtime allocations for struct messages
  4. 04Clear static bindings when exiting Play Mode

Use cases

  1. 01Decouple systems with typed event messages
  2. 02Dispatch struct-based events without runtime garbage collection
  3. 03Prevent stale static bindings between Play Mode sessions

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/muharremtozan/unity-agent-skills --skill unity-event-bus

After installing, type/unity-event-busin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/code/
EventBusBootstrapper.cs.txt
EventBusCore.cs.txt
EventBusExample.cs.txt
assets/docs/
Checklist.md.txt
references/
guide.md

Details

From the project README

Unity Advanced Event Bus

This skill provides a high-performance, type-safe messaging hub for Unity projects. It is designed for developers who want to decouple systems without the overhead of ScriptableObject-based event channels.

Core Features

  1. Reflection Bootstrapping: Automatically finds all events and initializes buses on game load.
  2. Generic Performance: Uses static generic indices for O(1) event dispatch performance.
  3. Zero Allocation: Optimized for structs to ensure no runtime garbage collection for messages.
  4. Editor Safety: Auto-clears all static bindings when exiting Play Mode to prevent Editor memory leaks.

Core Files (Max 3)

  • EventBusCore.cs.txt: Base interfaces and the static generic bus hub.
  • EventBusBootstrapper.cs.txt: Unity-specific auto-initialization and assembly scanning.
  • EventBusExample.cs.txt: Practical implementation of player and system events.

Usage

Define a struct : IEvent, create an EventBinding<T>, and register it in OnEnable. Raise events from anywhere using EventBus<T>.Raise().

Comments

Markdown supported