IEventBus Interface
Abstraction for the engine's pub/sub event bus. Inject this interface (rather than the concrete EventBus) in scenes and systems to keep them testable and decoupled from the implementation.
public interface IEventBus
Derived
↳ EventBus
| Methods | |
|---|---|
| ClearAll() | Clears all subscribers for all event types. |
| ClearSubscribers<T>() | Clears all subscribers for a specific event type. |
| Publish<T>(T) | Publishes an event to all current subscribers of type T. |
| Subscribe<T>(Action<T>) | Subscribes to events of type T and returns a disposal token that unsubscribes automatically when disposed. Prefer this overload to avoid stale subscriptions when scenes are unloaded. |
| Unsubscribe<T>(Action<T>) | Manually unsubscribes a handler. Prefer disposing the token returned by Subscribe<T>(Action<T>) — it calls this method and is idempotent. |