A class in Root.Township, the global namespace.
Fires a Unity event when its entity is destroyed, on the sides you pick. Also fires when the entity is unloaded.
Constructors
| Member | What it is |
|---|
OnDestroyEvent() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private AltaEvent destroyEvent | Event to fire. |
private bool isCallingInLocalTest | Fire in local test. |
private bool isCallingOnClient | Fire on clients. |
private bool isCallingOnServer | Fire on the server. |
private bool isUsingUnityDestroy | If true, fires from Unity's OnDestroy, when child objects are already gone, instead of the scene destroy event. |
Methods
| Member | What it is |
|---|
override void Initialize() | Hooks the entity's scene destroy event, unless using Unity's destroy. |
3 private and internal methods
| Member | What it is |
|---|
private void Destroyed() | Fires the event if this side is enabled. |
private void EntityDestroyedByScene(NetworkEntity entity, bool isUnload) | Calls Destroyed when the scene destroys or unloads the entity. |
private void OnDestroy() | Calls Destroyed if using Unity's destroy. |