Unit Spawned =============== .. code-block:: csharp public event UnitAction UnitReady .. note:: This used to be a static event named ``Unit.UnitSpawned``. It has since moved to ``UnitsService`` (renamed to ``UnitReady``) as a regular instance event — inject ``UnitsService`` to subscribe to it, as shown below. This event is fired every time any unit is spawned and fully initialized. **Example** For example, you can do something when any unit is spawned. You can receive info about the spawn by connecting to the ``UnitsService.UnitReady`` event. .. code-block:: csharp // this example code can be run from any MonoBehaviour script [Inject] UnitsService units; void Start() { units.UnitReady += OnUnitReady; // now every time any unit is spawned, the OnUnitReady method will be called and... } void OnUnitReady(Unit unit) { Debug.Log("Spawned a new unit " + unit.name); // ... this message will appear in the Console. } void OnDestroy() { units.UnitReady -= OnUnitReady; // don't forget to unsubscribe! }