EventBus.Subscribe(Action) Method
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:
// In OnEnter:
_subscription = Game.EventBus.Subscribe<EnemyDiedEvent>(OnEnemyDied);
// In OnExit:
_subscription.Dispose();
public System.IDisposable Subscribe<T>(System.Action<T> handler)
where T : class;
Type parameters¶
T
Parameters¶
handler System.Action<T>
Implements Subscribe<T>(Action<T>)