Skip to content

SubscriptionHandle

Namespace: SideXP.Broadcaster | Inherits from: IDisposable

public struct SubscriptionHandle : IDisposable

Handle to a single registration on an EventBus, returned by every registration call. Disposing it unregisters that one registration.

Remarks

Handles complement owner-based cleanup, they don't replace it: UnregisterAll in OnDisable() is the blessed one-liner, while a handle is for fine-grained lifetimes. Disposing is idempotent and safe on default(SubscriptionHandle).

Properties

IsActive

public bool IsActive

Is the registration this handle points to still active (not yet unregistered)? Always false for a default handle.

Methods

Dispose()

public void Dispose()

Unregisters the registration this handle points to. Idempotent. A no-op on a default handle or once the registration has already been removed.