The Scenario Spawner is an extension for RuntimeSpawner that restricts spawning to a curated set of authored Scenario Points instead of arbitrary locations in the world.
It allows designers to maintain population targets for gameplay groups (such as enemies, pickups, or objectives) while ensuring entities appear only at specific spawn locations.
The system works by directing RuntimeSpawner to spawn entities at valid Scenario Points and tracking the resulting population so it can maintain configured targets.
The default RuntimeSpawner is designed for systemic spawning. It can place entities anywhere within a valid region using placement hints, navmesh checks, and spawn rules.
However, many gameplay scenarios require controlled, designer-authored spawn locations.
Examples include:
- guards spawning at specific patrol starts
- loot containers appearing inside buildings
- survivors spawning at rescue locations
- enemies appearing at encounter entry points
- mission objectives spawning at designated spots
The Scenario Spawner Add-On bridges this gap by maintaining spawn populations while limiting where spawns may occur.
Entities only spawn at registered Scenario Points placed in the scene.
Groups can define a TargetCount, and the system will spawn entities until that target is reached.
Scenario points are grouped by Category, allowing different spawn groups to use different sets of points.
Each point can enforce a respawn cooldown, preventing rapid repeated spawns at the same location.
The system uses the existing RuntimeSpawner pipeline, meaning it inherits:
- spawn entries
- spawn rules
- object pooling
- spawn tags
- placement logic
The add-on simply overrides the spawn location selection.
A Scenario Point represents an authored spawn location in the scene.
Each point defines:
- PointId – unique identifier
- Category – logical grouping of points
- SpawnHint – transform used as the spawn position
Points automatically register themselves in the ScenarioPointRegistry so they can be discovered by the system at runtime.
Example:
WarehouseGuard_01
WarehouseGuard_02
RoofSniper_01
ParkingLot_01
A Scenario Group defines a population rule.
Example configuration:
GroupId: Guards
TargetCount: 6
PointCategory: Bots
RespawnCooldown: 15
Meaning:
- Maintain 6 guards
- Spawn only at Bots category scenario points
- Enforce 15 seconds cooldown per point
The ScenarioSpawnerAddon is the runtime driver.
It periodically:
- checks current population for each group
- determines how many entities need to spawn
- selects an available scenario point
- requests a spawn from RuntimeSpawner
- tracks the spawned entity
When an entity despawns or dies, the population count is reduced, allowing the system to refill the group later.
The system runs a simple update loop.
Every tick:
for each group
if alive < target
select spawn entry
select valid scenario point
spawn entity
Spawn location selection is overridden by injecting a forced spawn hint into the RuntimeSpawner spawn context.
This allows RuntimeSpawner to handle the spawn while guaranteeing the location comes from the scenario system.
- Place ScenarioPoint components in the scene
- Assign each point a Category
- Configure ScenarioGroupConfig entries
- Add ScenarioSpawnerAddon to the scene
- Link it to a RuntimeSpawner
At runtime the system will automatically maintain the configured populations.
GuardPoint_A
GuardPoint_B
GuardPoint_C
GuardPoint_D
Category:
Bots
GroupId: Guards
TargetCount: 3
PointCategory: Bots
RespawnCooldown: 20
- System spawns 3 guards
- Player eliminates one
- After cooldown expires
- A new guard spawns at a valid guard point
Use the Scenario Spawner when:
- spawn locations must be controlled
- encounters require designer-placed spawn points
- gameplay readability is important
- prototypes need predictable spawn locations
Do not use ScenarioSpawner when you want:
- large systemic spawn regions
- procedural world population
- distance-based spawning around the player
In those cases the default RuntimeSpawner is more appropriate.
RuntimeSpawner handles:
- spawning logic
- spawn entries
- pooling
- spawn validation
ScenarioSpawner handles:
- where spawns are allowed to occur
This separation allows both systems to remain simple and reusable.
The system is intentionally lightweight and can be extended with additional features such as:
- weighted spawn point selection
- distance checks against the player
- spawn point occupancy tracking
- round-robin point distribution
- dynamic enabling/disabling of spawn points
Part of the MegaCrush RuntimeSpawner ecosystem.