Skip to main content

DestroyedEventCaller

A class in Root.Township, the global namespace.

Helper that lets code get a callback when a NetworkEntity's GameObject is destroyed. Added to the entity by AttachTo.

Constructors​

MemberWhat it is
DestroyedEventCaller()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

1 private and internal field
MemberWhat it is
private NetworkEntity entityThe entity passed to the callback.

Events​

MemberWhat it is
event Action<NetworkEntity> CallbackRaised with the entity when it is destroyed, except while the app is quitting.

Methods​

MemberWhat it is
static void AttachTo(NetworkEntity target, Action<NetworkEntity> callback)Adds the component to the entity if needed and subscribes the callback.
static void Detach(NetworkEntity target, Action<NetworkEntity> callback)Unsubscribes the callback.
1 private and internal method
MemberWhat it is
private void OnDestroy()Raises Callback unless the app is quitting.