Runtime Spawner 1.2.5
Generic Runtime spawn and instance pooling system for spawning random AI agents around a map. Works with ANY AI system easily.
Loading...
Searching...
No Matches
MegaCrush.Spawner.RuntimeSpawner Class Reference

Central coordinator for runtime spawning. Supports three spawn flows:

Also provides optional internal culling beyond a configurable distance and integrates with an object pool. More...

Inheritance diagram for MegaCrush.Spawner.RuntimeSpawner:

Public Member Functions

void SetConcurrentAliveCap (int cap)
 Sets the upper limit for concurrently alive spawned objects (global/region/wave combined).
 
void SetGlobalSpawnWindow (int min, int max)
 Sets the target global spawn window. The global loop tries to keep population within these bounds.
 
void SetSpawnRateMultiplier (float mult)
 Applies a multiplier to the global spawn tick rate. Values < 1 slow down, > 1 speed up.
 
void SetWaveRateMultiplier (float mult)
 Applies a multiplier to the wave interval timing. Values < 1 shorten intervals, > 1 lengthen them.
 
void Init ()
 Discovers child regions, wires services, synchronizes events, and initializes collaborators. Safe to call multiple times; subsequent calls re-scan regions and clear internal caches.
 
void StartSpawners ()
 Creates object pools and starts the enabled spawn loops (global, region, wave collaborators). Calls Init if not already initialized.
 
void SetPlayer (GameObject player)
 Assigns the player object used for distance checks and context building.
 
void SetStartAutomatically (bool value)
 Sets whether the spawner should automatically initialize and start on Start.
 
void ActivateWaveTrigger (WaveTrigger trigger)
 Programmatically activates a wave trigger using the same internal flow as volume activation.
 
void DeactivateWaveTrigger (WaveTrigger trigger)
 Stops a running wave sequence and marks the trigger as inactive.
 
void NotifyWaveTriggerActivated (WaveTrigger trigger)
 Notifies listeners that a wave trigger has been activated. Safe instance-side way to forward triggers without touching static events.
 
void AddRegion ()
 Creates a new child LocalAreaSpawner with a default BoxCollider trigger.
 
void ShowHideSpawnVolumes ()
 Toggles visibility of region spawn volumes in Scene View.
 
void ShowHideWaveTriggers ()
 Toggles visibility of wave triggers in Scene View.
 
WaveTrigger AddWaveTrigger ()
 Creates and adds a new WaveTrigger child with a default BoxCollider trigger.
 
void ShowOccluderRange ()
 Toggles drawing of the culling radius gizmo around the player.
 
void DrawWorldExtents ()
 Toggles drawing of world extents gizmo.
 

Static Public Member Functions

static void Despawn (GameObject go)
 Convenience API to despawn a spawned object when the owner spawner is unknown. Attempts to resolve the owner spawner; falls back to any spawner in scene or destroys the object.
 
static WaveSpawner CreateWaveSpawner (string path)
 Creates a WaveSpawner asset at the given project path.
 
static SpawnEntry CreateSpawnEntry (string path)
 Creates a SpawnEntry asset at the given project path.
 

Properties

bool UseInternalCulling [get, set]
 Enables the built-in culling loop that despawns objects farther than cullDistance from the player.
 
bool UseGlobalSpawners [get, set]
 Enables global spawners (non-localized spawns that obey global population caps).
 
bool UseRegionSpawners [get, set]
 Enables region spawners (localized spawns activated by player presence in LocalAreaSpawners).
 
bool UseWaveSpawners [get, set]
 Enables wave spawners (scriptable wave tables triggered via WaveTrigger).
 
string PlayerTag [get, set]
 Tag used to locate the player (if playerObject is not assigned).
 
List< GameObject > SpawnedObjects [get]
 Live list of spawned objects. Kept in sync by PopulationTracker.
 
List< SpawnEntryGlobalSpawners [get, set]
 Global spawn entries used by the global spawn loop.
 
List< string > NavmeshAreas [get, set]
 Optional list of NavMesh area names to constrain spawn placement.
 
List< LocalAreaSpawnerSpawnRegions [get, set]
 All configured spawn regions (children discovered on Init).
 
List< WaveTriggerWaveTriggers [get, set]
 Configured wave triggers for table-driven encounters.
 
float CullDistance [get]
 Culling radius in world units.
 
Vector2 WorldSizeVector2 [get]
 World extents (X,Z) for global spawning and gizmos.
 
float MinSpawnRange [get]
 Minimum allowed distance from player for spawn placement.
 
int MinGlobalObjectCount [get, set]
 Minimum desired global population (the global loop tries to maintain between min/max).
 
int MaxGlobalObjectCount [get, set]
 Maximum desired global population (the global loop tries to maintain between min/max).
 
Transform PlayerTransform [get]
 Player transform for range checks and spawn context; returns null if unknown.
 
Vector3 WorldSizeVector3 [get]
 World extents as a 3D vector (Y fixed to 5 for visualization).
 
bool LogSpawnEntries [get]
 Enables logging of key spawn events to the Console.
 
bool DrawExtents [get]
 When true, draws world extents in Scene View.
 
bool IsInitialized [get]
 property so other services can check if the spawner is active and ready
 
PopulationTracker Population [get]
 Exposes the population tracker.
 
ISpawnExecutor Executor [get]
 Exposes the spawn executor used by all loops.
 
ISpawnLocator Locator [get]
 Exposes the spawn locator used for placement queries.
 

Events

static Action< GameObject > onObjectSpawned
 Raised when an object is spawned by any loop.
 
static Action< GameObject > onObjectCulled
 Raised when an object is culled (internal or manual despawn).
 
static Action< int > onUpdateCurrentPopulation
 Raised when total spawned population changes.
 
static Action< float > onSpawnerInit
 Raised after Init; supplies the configured cullDistance.
 
static Action< WaveEntryonNewWaveTriggered
 Raised when a wave entry is about to begin.
 
static Action< WaveTriggeronWaveTriggerActivated
 Raised when a wave trigger volume becomes active.
 
static Action< WaveTriggeronWaveSpawnerComplete
 Raised when a wave spawner completes its sequence.
 

Private Member Functions

void Awake ()
 
void OnDisable ()
 
void Start ()
 
void CreateObjectPools ()
 Ensures object pools exist for all configured global, region, and wave entries.
 
IEnumerator DoCulling ()
 Periodically checks spawned objects and despawns them if they exceed CullDistance.
 
void DespawnInternal (GameObject go)
 Returns an instance to the pool, updates population and events, and clears ownership bookkeeping.
 
void OnPlayerEnteredRegion (LocalAreaSpawner region, bool isInRegion)
 Maintains the active region set based on player presence notifications from LocalAreaSpawner.
 
void OnWaveTriggerActivated (WaveTrigger thisTrigger)
 Handles activation of wave triggers and starts their wave sequence coroutine.
 
IEnumerator DeferWaveUntilInitialized (WaveTrigger trigger)
 
IEnumerator RunWaveSequence (WaveTrigger trigger)
 Runs the configured waves for a trigger once (per-wave looping policy honored inside the runner).
 
void OnUnitDied (GameObject thisObject)
 Callback hook for unit death; returns the object to pool and updates bookkeeping.
 
void OnObjectCulled (GameObject thisObject)
 Callback hook for culling; returns the object to pool and updates bookkeeping.
 
RuntimeSpawnerSettings GetSettings ()
 Loads or creates the editor settings asset for gizmo colors and other preferences.
 
void OnDrawGizmosSelected ()
 

Private Attributes

string playerTag = "Player"
 
GameObject playerObject
 
bool autoLaunchOnStart = false
 
bool logSpawnEntries = false
 
bool drawExtents = false
 
Vector2 worldSize = new(50, 50)
 
float minSpawnRange = 25
 
LayerMask layerMask
 
List< string > restrictToNavmeshAreas = new()
 
bool useInternalCulling = true
 
float cullDistance = 100
 
int cullingCheckFrequency = 2
 
string spawnerTag = string.Empty
 
bool useGlobalSpawners = false
 
List< SpawnEntryglobalSpawners = new()
 
int minGlobalObjectCount = 25
 
int maxGlobalObjectCount = 25
 
int maxObjectCount = 100
 
bool useRegionSpawners = false
 
List< LocalAreaSpawnerspawnRegions = new()
 
List< LocalAreaSpawneractiveSpawnRegions = new()
 
bool useWaveSpawners = false
 
List< WaveTriggerwaveTriggers = new()
 
List< GameObject > spawnedObjects = new()
 Retained for Inspector display; kept in sync by PopulationTracker.
 
readonly List< GameObject > newGlobalSpawners = new()
 
readonly List< GameObject > newRegionSpawners = new()
 
readonly List< GameObject > newWaveSpawners = new()
 
float _spawnRateMult = 1f
 
float _waveRateMult = 1f
 
bool initialized = false
 
bool showSpawnVolumes = true
 
bool showSpawnTriggers = false
 
bool showOccluderRange = false
 
PopulationTracker _pop
 
IPoolAdapter _pool
 
ISpawnLocator _locator
 
ISpawnExecutor _executor
 
GlobalSpawnLoop _globalLoop
 
RegionSpawnLoop _regionLoop
 
IWaveExecutor _waveExec
 
Coroutine _globalCoro
 
Coroutine _regionCoro
 
readonly Dictionary< WaveTrigger, Coroutine > _waveCoros = new()
 
RuntimeSpawnerSettings settings
 

Static Private Attributes

static readonly Dictionary< GameObject, RuntimeSpawners_OwnerByGO = new()
 Static registry mapping spawned instances back to their owning RuntimeSpawner. Used to route Despawn(GameObject) when the owner isn't directly known.
 

Detailed Description

Central coordinator for runtime spawning. Supports three spawn flows:

  • Global spawning – distributed across the world with population caps.
  • Region spawning – localized spawners that activate when the player enters a region.
  • Wave spawning – table-driven encounter waves triggered by WaveTrigger volumes.

Also provides optional internal culling beyond a configurable distance and integrates with an object pool.

Member Function Documentation

◆ ActivateWaveTrigger()

void MegaCrush.Spawner.RuntimeSpawner.ActivateWaveTrigger ( WaveTrigger trigger)

Programmatically activates a wave trigger using the same internal flow as volume activation.

◆ AddRegion()

void MegaCrush.Spawner.RuntimeSpawner.AddRegion ( )

Creates a new child LocalAreaSpawner with a default BoxCollider trigger.

◆ AddWaveTrigger()

WaveTrigger MegaCrush.Spawner.RuntimeSpawner.AddWaveTrigger ( )

Creates and adds a new WaveTrigger child with a default BoxCollider trigger.

◆ Awake()

void MegaCrush.Spawner.RuntimeSpawner.Awake ( )
private

◆ CreateObjectPools()

void MegaCrush.Spawner.RuntimeSpawner.CreateObjectPools ( )
private

Ensures object pools exist for all configured global, region, and wave entries.

◆ CreateSpawnEntry()

static SpawnEntry MegaCrush.Spawner.RuntimeSpawner.CreateSpawnEntry ( string path)
static

Creates a SpawnEntry asset at the given project path.

◆ CreateWaveSpawner()

static WaveSpawner MegaCrush.Spawner.RuntimeSpawner.CreateWaveSpawner ( string path)
static

Creates a WaveSpawner asset at the given project path.

◆ DeactivateWaveTrigger()

void MegaCrush.Spawner.RuntimeSpawner.DeactivateWaveTrigger ( WaveTrigger trigger)

Stops a running wave sequence and marks the trigger as inactive.

◆ DeferWaveUntilInitialized()

IEnumerator MegaCrush.Spawner.RuntimeSpawner.DeferWaveUntilInitialized ( WaveTrigger trigger)
private

◆ Despawn()

static void MegaCrush.Spawner.RuntimeSpawner.Despawn ( GameObject go)
static

Convenience API to despawn a spawned object when the owner spawner is unknown. Attempts to resolve the owner spawner; falls back to any spawner in scene or destroys the object.

Parameters
goSpawned object to despawn.

◆ DespawnInternal()

void MegaCrush.Spawner.RuntimeSpawner.DespawnInternal ( GameObject go)
private

Returns an instance to the pool, updates population and events, and clears ownership bookkeeping.

Parameters
goObject to despawn.

◆ DoCulling()

IEnumerator MegaCrush.Spawner.RuntimeSpawner.DoCulling ( )
private

Periodically checks spawned objects and despawns them if they exceed CullDistance.

◆ DrawWorldExtents()

void MegaCrush.Spawner.RuntimeSpawner.DrawWorldExtents ( )

Toggles drawing of world extents gizmo.

◆ GetSettings()

RuntimeSpawnerSettings MegaCrush.Spawner.RuntimeSpawner.GetSettings ( )
private

Loads or creates the editor settings asset for gizmo colors and other preferences.

◆ Init()

void MegaCrush.Spawner.RuntimeSpawner.Init ( )

Discovers child regions, wires services, synchronizes events, and initializes collaborators. Safe to call multiple times; subsequent calls re-scan regions and clear internal caches.

◆ NotifyWaveTriggerActivated()

void MegaCrush.Spawner.RuntimeSpawner.NotifyWaveTriggerActivated ( WaveTrigger trigger)

Notifies listeners that a wave trigger has been activated. Safe instance-side way to forward triggers without touching static events.

◆ OnDisable()

void MegaCrush.Spawner.RuntimeSpawner.OnDisable ( )
private

◆ OnDrawGizmosSelected()

void MegaCrush.Spawner.RuntimeSpawner.OnDrawGizmosSelected ( )
private

◆ OnObjectCulled()

void MegaCrush.Spawner.RuntimeSpawner.OnObjectCulled ( GameObject thisObject)
private

Callback hook for culling; returns the object to pool and updates bookkeeping.

◆ OnPlayerEnteredRegion()

void MegaCrush.Spawner.RuntimeSpawner.OnPlayerEnteredRegion ( LocalAreaSpawner region,
bool isInRegion )
private

Maintains the active region set based on player presence notifications from LocalAreaSpawner.

◆ OnUnitDied()

void MegaCrush.Spawner.RuntimeSpawner.OnUnitDied ( GameObject thisObject)
private

Callback hook for unit death; returns the object to pool and updates bookkeeping.

◆ OnWaveTriggerActivated()

void MegaCrush.Spawner.RuntimeSpawner.OnWaveTriggerActivated ( WaveTrigger thisTrigger)
private

Handles activation of wave triggers and starts their wave sequence coroutine.

◆ RunWaveSequence()

IEnumerator MegaCrush.Spawner.RuntimeSpawner.RunWaveSequence ( WaveTrigger trigger)
private

Runs the configured waves for a trigger once (per-wave looping policy honored inside the runner).

◆ SetConcurrentAliveCap()

void MegaCrush.Spawner.RuntimeSpawner.SetConcurrentAliveCap ( int cap)

Sets the upper limit for concurrently alive spawned objects (global/region/wave combined).

Parameters
capNew concurrent alive cap (min 1).

◆ SetGlobalSpawnWindow()

void MegaCrush.Spawner.RuntimeSpawner.SetGlobalSpawnWindow ( int min,
int max )

Sets the target global spawn window. The global loop tries to keep population within these bounds.

Parameters
minMinimum desired population (clamped to ≥ 0).
maxMaximum desired population (clamped to ≥ min ).

◆ SetPlayer()

void MegaCrush.Spawner.RuntimeSpawner.SetPlayer ( GameObject player)

Assigns the player object used for distance checks and context building.

◆ SetSpawnRateMultiplier()

void MegaCrush.Spawner.RuntimeSpawner.SetSpawnRateMultiplier ( float mult)

Applies a multiplier to the global spawn tick rate. Values < 1 slow down, > 1 speed up.

Parameters
multRate multiplier (min 0.01).

◆ SetStartAutomatically()

void MegaCrush.Spawner.RuntimeSpawner.SetStartAutomatically ( bool value)

Sets whether the spawner should automatically initialize and start on Start.

◆ SetWaveRateMultiplier()

void MegaCrush.Spawner.RuntimeSpawner.SetWaveRateMultiplier ( float mult)

Applies a multiplier to the wave interval timing. Values < 1 shorten intervals, > 1 lengthen them.

Parameters
multWave timing multiplier (min 0.01).

◆ ShowHideSpawnVolumes()

void MegaCrush.Spawner.RuntimeSpawner.ShowHideSpawnVolumes ( )

Toggles visibility of region spawn volumes in Scene View.

◆ ShowHideWaveTriggers()

void MegaCrush.Spawner.RuntimeSpawner.ShowHideWaveTriggers ( )

Toggles visibility of wave triggers in Scene View.

◆ ShowOccluderRange()

void MegaCrush.Spawner.RuntimeSpawner.ShowOccluderRange ( )

Toggles drawing of the culling radius gizmo around the player.

◆ Start()

void MegaCrush.Spawner.RuntimeSpawner.Start ( )
private

◆ StartSpawners()

void MegaCrush.Spawner.RuntimeSpawner.StartSpawners ( )

Creates object pools and starts the enabled spawn loops (global, region, wave collaborators). Calls Init if not already initialized.

Member Data Documentation

◆ _executor

ISpawnExecutor MegaCrush.Spawner.RuntimeSpawner._executor
private

◆ _globalCoro

Coroutine MegaCrush.Spawner.RuntimeSpawner._globalCoro
private

◆ _globalLoop

GlobalSpawnLoop MegaCrush.Spawner.RuntimeSpawner._globalLoop
private

◆ _locator

ISpawnLocator MegaCrush.Spawner.RuntimeSpawner._locator
private

◆ _pool

IPoolAdapter MegaCrush.Spawner.RuntimeSpawner._pool
private

◆ _pop

PopulationTracker MegaCrush.Spawner.RuntimeSpawner._pop
private

◆ _regionCoro

Coroutine MegaCrush.Spawner.RuntimeSpawner._regionCoro
private

◆ _regionLoop

RegionSpawnLoop MegaCrush.Spawner.RuntimeSpawner._regionLoop
private

◆ _spawnRateMult

float MegaCrush.Spawner.RuntimeSpawner._spawnRateMult = 1f
private

◆ _waveCoros

readonly Dictionary<WaveTrigger, Coroutine> MegaCrush.Spawner.RuntimeSpawner._waveCoros = new()
private

◆ _waveExec

IWaveExecutor MegaCrush.Spawner.RuntimeSpawner._waveExec
private

◆ _waveRateMult

float MegaCrush.Spawner.RuntimeSpawner._waveRateMult = 1f
private

◆ activeSpawnRegions

List<LocalAreaSpawner> MegaCrush.Spawner.RuntimeSpawner.activeSpawnRegions = new()
private

◆ autoLaunchOnStart

bool MegaCrush.Spawner.RuntimeSpawner.autoLaunchOnStart = false
private

◆ cullDistance

float MegaCrush.Spawner.RuntimeSpawner.cullDistance = 100
private

◆ cullingCheckFrequency

int MegaCrush.Spawner.RuntimeSpawner.cullingCheckFrequency = 2
private

◆ drawExtents

bool MegaCrush.Spawner.RuntimeSpawner.drawExtents = false
private

◆ globalSpawners

List<SpawnEntry> MegaCrush.Spawner.RuntimeSpawner.globalSpawners = new()
private

◆ initialized

bool MegaCrush.Spawner.RuntimeSpawner.initialized = false
private

◆ layerMask

LayerMask MegaCrush.Spawner.RuntimeSpawner.layerMask
private

◆ logSpawnEntries

bool MegaCrush.Spawner.RuntimeSpawner.logSpawnEntries = false
private

◆ maxGlobalObjectCount

int MegaCrush.Spawner.RuntimeSpawner.maxGlobalObjectCount = 25
private

◆ maxObjectCount

int MegaCrush.Spawner.RuntimeSpawner.maxObjectCount = 100
private

◆ minGlobalObjectCount

int MegaCrush.Spawner.RuntimeSpawner.minGlobalObjectCount = 25
private

◆ minSpawnRange

float MegaCrush.Spawner.RuntimeSpawner.minSpawnRange = 25
private

◆ newGlobalSpawners

readonly List<GameObject> MegaCrush.Spawner.RuntimeSpawner.newGlobalSpawners = new()
private

◆ newRegionSpawners

readonly List<GameObject> MegaCrush.Spawner.RuntimeSpawner.newRegionSpawners = new()
private

◆ newWaveSpawners

readonly List<GameObject> MegaCrush.Spawner.RuntimeSpawner.newWaveSpawners = new()
private

◆ playerObject

GameObject MegaCrush.Spawner.RuntimeSpawner.playerObject
private

◆ playerTag

string MegaCrush.Spawner.RuntimeSpawner.playerTag = "Player"
private

◆ restrictToNavmeshAreas

List<string> MegaCrush.Spawner.RuntimeSpawner.restrictToNavmeshAreas = new()
private

◆ s_OwnerByGO

readonly Dictionary<GameObject, RuntimeSpawner> MegaCrush.Spawner.RuntimeSpawner.s_OwnerByGO = new()
staticprivate

Static registry mapping spawned instances back to their owning RuntimeSpawner. Used to route Despawn(GameObject) when the owner isn't directly known.

◆ settings

RuntimeSpawnerSettings MegaCrush.Spawner.RuntimeSpawner.settings
private

◆ showOccluderRange

bool MegaCrush.Spawner.RuntimeSpawner.showOccluderRange = false
private

◆ showSpawnTriggers

bool MegaCrush.Spawner.RuntimeSpawner.showSpawnTriggers = false
private

◆ showSpawnVolumes

bool MegaCrush.Spawner.RuntimeSpawner.showSpawnVolumes = true
private

◆ spawnedObjects

List<GameObject> MegaCrush.Spawner.RuntimeSpawner.spawnedObjects = new()
private

Retained for Inspector display; kept in sync by PopulationTracker.

◆ spawnerTag

string MegaCrush.Spawner.RuntimeSpawner.spawnerTag = string.Empty
private

◆ spawnRegions

List<LocalAreaSpawner> MegaCrush.Spawner.RuntimeSpawner.spawnRegions = new()
private

◆ useGlobalSpawners

bool MegaCrush.Spawner.RuntimeSpawner.useGlobalSpawners = false
private

◆ useInternalCulling

bool MegaCrush.Spawner.RuntimeSpawner.useInternalCulling = true
private

◆ useRegionSpawners

bool MegaCrush.Spawner.RuntimeSpawner.useRegionSpawners = false
private

◆ useWaveSpawners

bool MegaCrush.Spawner.RuntimeSpawner.useWaveSpawners = false
private

◆ waveTriggers

List<WaveTrigger> MegaCrush.Spawner.RuntimeSpawner.waveTriggers = new()
private

◆ worldSize

Vector2 MegaCrush.Spawner.RuntimeSpawner.worldSize = new(50, 50)
private

Property Documentation

◆ CullDistance

float MegaCrush.Spawner.RuntimeSpawner.CullDistance
get

Culling radius in world units.

◆ DrawExtents

bool MegaCrush.Spawner.RuntimeSpawner.DrawExtents
get

When true, draws world extents in Scene View.

◆ Executor

ISpawnExecutor MegaCrush.Spawner.RuntimeSpawner.Executor
get

Exposes the spawn executor used by all loops.

◆ GlobalSpawners

List<SpawnEntry> MegaCrush.Spawner.RuntimeSpawner.GlobalSpawners
getset

Global spawn entries used by the global spawn loop.

◆ IsInitialized

bool MegaCrush.Spawner.RuntimeSpawner.IsInitialized
get

property so other services can check if the spawner is active and ready

◆ Locator

ISpawnLocator MegaCrush.Spawner.RuntimeSpawner.Locator
get

Exposes the spawn locator used for placement queries.

◆ LogSpawnEntries

bool MegaCrush.Spawner.RuntimeSpawner.LogSpawnEntries
get

Enables logging of key spawn events to the Console.

◆ MaxGlobalObjectCount

int MegaCrush.Spawner.RuntimeSpawner.MaxGlobalObjectCount
getset

Maximum desired global population (the global loop tries to maintain between min/max).

◆ MinGlobalObjectCount

int MegaCrush.Spawner.RuntimeSpawner.MinGlobalObjectCount
getset

Minimum desired global population (the global loop tries to maintain between min/max).

◆ MinSpawnRange

float MegaCrush.Spawner.RuntimeSpawner.MinSpawnRange
get

Minimum allowed distance from player for spawn placement.

◆ NavmeshAreas

List<string> MegaCrush.Spawner.RuntimeSpawner.NavmeshAreas
getset

Optional list of NavMesh area names to constrain spawn placement.

◆ PlayerTag

string MegaCrush.Spawner.RuntimeSpawner.PlayerTag
getset

Tag used to locate the player (if playerObject is not assigned).

◆ PlayerTransform

Transform MegaCrush.Spawner.RuntimeSpawner.PlayerTransform
get

Player transform for range checks and spawn context; returns null if unknown.

◆ Population

PopulationTracker MegaCrush.Spawner.RuntimeSpawner.Population
get

Exposes the population tracker.

◆ SpawnedObjects

List<GameObject> MegaCrush.Spawner.RuntimeSpawner.SpawnedObjects
get

Live list of spawned objects. Kept in sync by PopulationTracker.

◆ SpawnRegions

List<LocalAreaSpawner> MegaCrush.Spawner.RuntimeSpawner.SpawnRegions
getset

All configured spawn regions (children discovered on Init).

◆ UseGlobalSpawners

bool MegaCrush.Spawner.RuntimeSpawner.UseGlobalSpawners
getset

Enables global spawners (non-localized spawns that obey global population caps).

◆ UseInternalCulling

bool MegaCrush.Spawner.RuntimeSpawner.UseInternalCulling
getset

Enables the built-in culling loop that despawns objects farther than cullDistance from the player.

◆ UseRegionSpawners

bool MegaCrush.Spawner.RuntimeSpawner.UseRegionSpawners
getset

Enables region spawners (localized spawns activated by player presence in LocalAreaSpawners).

◆ UseWaveSpawners

bool MegaCrush.Spawner.RuntimeSpawner.UseWaveSpawners
getset

Enables wave spawners (scriptable wave tables triggered via WaveTrigger).

◆ WaveTriggers

List<WaveTrigger> MegaCrush.Spawner.RuntimeSpawner.WaveTriggers
getset

Configured wave triggers for table-driven encounters.

◆ WorldSizeVector2

Vector2 MegaCrush.Spawner.RuntimeSpawner.WorldSizeVector2
get

World extents (X,Z) for global spawning and gizmos.

◆ WorldSizeVector3

Vector3 MegaCrush.Spawner.RuntimeSpawner.WorldSizeVector3
get

World extents as a 3D vector (Y fixed to 5 for visualization).

Event Documentation

◆ onNewWaveTriggered

Action<WaveEntry> MegaCrush.Spawner.RuntimeSpawner.onNewWaveTriggered
static

Raised when a wave entry is about to begin.

◆ onObjectCulled

Action<GameObject> MegaCrush.Spawner.RuntimeSpawner.onObjectCulled
static

Raised when an object is culled (internal or manual despawn).

◆ onObjectSpawned

Action<GameObject> MegaCrush.Spawner.RuntimeSpawner.onObjectSpawned
static

Raised when an object is spawned by any loop.

◆ onSpawnerInit

Action<float> MegaCrush.Spawner.RuntimeSpawner.onSpawnerInit
static

Raised after Init; supplies the configured cullDistance.

◆ onUpdateCurrentPopulation

Action<int> MegaCrush.Spawner.RuntimeSpawner.onUpdateCurrentPopulation
static

Raised when total spawned population changes.

◆ onWaveSpawnerComplete

Action<WaveTrigger> MegaCrush.Spawner.RuntimeSpawner.onWaveSpawnerComplete
static

Raised when a wave spawner completes its sequence.

◆ onWaveTriggerActivated

Action<WaveTrigger> MegaCrush.Spawner.RuntimeSpawner.onWaveTriggerActivated
static

Raised when a wave trigger volume becomes active.


The documentation for this class was generated from the following file: