Spawning
VtMobSpawner keeps a number of monsters alive around a point and respawns them after they die.
Setup
- Create an empty GameObject where the monsters should appear.
- Add Vantage → Spawning → VtMobSpawner and drag the monster prefab into Prefab.
- Set Respawn Time on the monster’s unit definition. 0 means no respawn.
| Setting | Meaning |
|---|---|
| Variants | Optional weighted list of prefabs. When filled, every spawn rolls one of them instead of Prefab. |
| Count | How many units the point keeps alive. 3 makes a pack; each one respawns on its own timer. |
| Spawn Radius | Units appear at a random point within this distance. 0 is exactly at the spawner. |
| Spawn On Awake | Off means you call TrySpawn or SpawnAll yourself. |
| Respawns After Death | Respawn after the definition’s Respawn Time. |
| Reuse Instances | Revive the corpse in place on respawn instead of instantiating. Use it for dense areas. |
| Corpse Linger Seconds | Remove corpses after this long. 0 leaves them. Ignored with Reuse Instances. |
| Patrol Route | A VtPatrolRoute the spawned monsters walk, see AI roaming. |
Runtime
spawner.TrySpawn(out VtUnit spawned);
spawner.SpawnAll();
spawner.Despawn();
spawner.LiveUnits; spawner.LiveCount; spawner.PendingRespawns; spawner.RespawnSecondsRemaining;
spawner.Count = 5;
spawner.OnUnitSpawned += unit => { };
spawner.OnUnitDied += unit => { };
spawner.OnRespawnTimerStarted += seconds => { };
CurrentUnit is the first live unit, which is all you need for a single monster.
Common setups
- Boss after minions: Spawn On Awake off, call
TrySpawnfrom your encounter script. - Night-only: call
SpawnAllat dusk andDespawnat dawn. - Deterministic rolls in tests or replays:
SetRandomwith your ownIVtRandom.
For networked games override InstantiatePrefab in a subclass and register the instance with your networking layer.