The Spawned event

The Spawned event tells your mod each time a spawner spawns something.

Spawners the spawn event

Spawned is the event to subscribe to. It fires each time a spawner spawns, including the spawns the game makes on its own.

public static class Spawners
{
    public static event Action<SpawnerArgs> Spawned;
}
Event Gives you When it fires
Spawned SpawnerArgs A spawner spawned something.

SpawnerArgs what you get when a spawner spawns

The Spawned event gives you one of these. SpawnedCount is counted after this spawn.

public sealed class SpawnerArgs
{
    public string Id { get; }
    public string TypeName { get; }
    public int SpawnedCount { get; }
}
Property Type What it means
Id string The id of the spawner, as SpawnerInfo.Id.
TypeName string What kind of spawner it is.
SpawnedCount int How many things it has spawned, counted after this spawn.

Things to know

  • Spawned fires every time a spawner spawns, including the spawns the game makes by itself. That covers the spawn when a scene starts and the spawn on a map change, not just the ones you trigger. (it is raised from a postfix on Spawner.TrySpawn(bool) whenever the method returns true.)

Limits

  • Spawned can fire even though nothing new appeared. See the notes on TriggerNow in Spawning now.