Unit Destroyed

public static event UnitAction UnitDestroyed

This static event fired every time when any unit was destroyed.

Example

For example, you can do something when any unit destroyed. You can receive info about death by connecting to Unit.UnitDestroyed event.

using InsaneSystems.RTSStarterKit; // don't forget this directive if your script not in InsaneSystems.RTSStarterKit namespace.

// this example code can be run from any MonoBehaviour script

void Start()
{
        Unit.UnitDestroyedEvent += OnUnitDestroyed; // now every time when any unit being spawned, OnUnitDestroyed method will be fired and...
}

void OnUnitDestroyed(Unit unit)
{
        Debug.Log("Unit was destroyed: " + unit.name); // ... this message will appear in Console.
}

void OnDestroy()
{
        Unit.UnitDestroyedEvent -= OnUnitDestroyed; // since this is static event, do not forget to unsubscribe!
}