Overview
This reference documents all SWS components including their properties, methods, and events. Use this as your API documentation when implementing spawning systems.
Essential components
Single instance only
Data assets
Scene-based
SpawnManager
CoreSingletonCentral manager for all spawn operations. Handles the spawn queue, object pooling, and entity registry.
Properties
| Property | Type | Description |
|---|---|---|
| Settings | SpawnManagerSettings | Configuration asset for global settings |
| Pool Parent | Transform | Parent object for pooled entities |
| Auto Create Pool Parent | bool | Create pool parent if not assigned |
Methods
| Method | Description |
|---|---|
| QueueSpawn(SpawnRequest) | Adds a spawn request to the priority queue |
| Spawn(SpawnProfile, Vector3, Quaternion) | Immediately spawns an entity |
| DespawnAll() | Returns all active entities to pool |
| GetSpawnPoint(string tag) | Gets a spawn point by tag |
| GetSpawnPoints(string[] tags) | Gets spawn points matching tags |
Events
| Event | Description |
|---|---|
| OnEntitySpawned | Fired when an entity is spawned |
| OnEntityDespawned | Fired when an entity is returned to pool |
WaveController
CoreScene ComponentOrchestrates wave sequences including starting, pausing, resuming, and skipping waves.
Properties
| Property | Type | Description |
|---|---|---|
| Wave Sequence | WaveSequence | The sequence to play |
| Auto Start | bool | Start sequence on scene load |
| Auto Advance | bool | Automatically start next wave |
| Wave Delay | float | Delay between waves (seconds) |
Methods
| Method | Description |
|---|---|
| StartSequence() | Begins the wave sequence |
| StartWave(int index) | Starts a specific wave |
| PauseWave() | Pauses current wave spawning |
| ResumeWave() | Resumes paused wave |
| SkipWave() | Skips to the next wave |
| StopSequence() | Stops the entire sequence |
Events
| Event | Description |
|---|---|
| OnWaveStarted | Fired when a wave begins |
| OnWaveCompleted | Fired when a wave ends |
| OnSequenceCompleted | Fired when all waves complete |
| OnSpawningComplete | Fired when all entities for a wave have spawned |
SpawnPoint
Scene ComponentMarks a valid spawn location in the scene with optional constraints and path references.
Properties
| Property | Type | Description |
|---|---|---|
| Tags | string[] | Tags for filtering spawn points |
| Spawn Radius | float | Random offset radius from center |
| Max Concurrent | int | Maximum active entities from this point |
| Cooldown | float | Minimum time between spawns |
| Path Anchor | PathAnchor | Default path for spawned entities |
| Spawn Offset | Vector3 | Position offset from transform |
Methods
| Method | Description |
|---|---|
| CanSpawn() | Returns true if spawn point is available |
| GetSpawnPosition() | Gets a position within the spawn radius |
| RegisterSpawn() | Marks a spawn as occurring |
SpawnProfile
ScriptableObjectDefines what to spawn including prefab, variants, pooling settings, and budget cost.
Properties
| Property | Type | Description |
|---|---|---|
| Profile ID | string | Unique identifier (auto-generated) |
| Display Name | string | Name for editor and UI |
| Icon | Sprite | Icon for editor and UI |
| Type | SpawnableType | Character, Projectile, Resource, etc. |
| Prefab | GameObject | Primary prefab to spawn |
| Variants | PrefabVariant[] | Weighted prefab alternatives |
| Budget Cost | int | Cost for wave budget balancing |
| Lifetime | float | Auto-despawn time (0 = infinite) |
| Random Y Rotation | bool | Spawn with random rotation |
| Spawn Offset | Vector3 | Position offset from spawn point |
| Use Pooling | bool | Enable object pooling |
| Pool Size | int | Initial pool size |
| Allow Growth | bool | Create more if pool is empty |
WaveDefinition
ScriptableObjectDefines a single wave including what to spawn, timing, and completion conditions.
Properties
| Property | Type | Description |
|---|---|---|
| Wave ID | string | Unique identifier (auto-generated) |
| Display Name | string | Name for UI and debugging |
| Description | string | Optional description |
| Allocations | SpawnAllocation[] | Profiles with spawn counts |
| Budget | int | Total budget (0 = use allocations directly) |
| Spawn Point Selection | SpawnPointSelection | Random, RoundRobin, Tagged |
| Spawn Point Tags | string[] | Filter spawn points by tags |
| Spawn Interval | float | Time between spawns |
| Random Interval | bool | Randomize spawn timing |
| End Condition | WaveEndCondition | When wave is complete |
| Time Limit | float | Duration for Timer end condition |
WaveSequence
ScriptableObjectGroups wave definitions into a playable sequence with mode and timing settings.
Properties
| Property | Type | Description |
|---|---|---|
| Sequence ID | string | Unique identifier (auto-generated) |
| Display Name | string | Name for UI and debugging |
| Waves | WaveDefinition[] | Array of wave definitions |
| Mode | SequenceMode | Single, Loop, or Endless |
| Auto Advance | bool | Automatically start next wave |
| Wave Delay | float | Delay between waves |
| Scale On Loop | bool | Increase difficulty each loop |
| Spawn Multiplier | float | Spawn count multiplier per loop |
| Stat Multiplier | float | Stat multiplier per loop |
SpawnedEntityTracker
Scene ComponentTracks entity lifecycle, health status, and handles defeat/despawn logic.
Properties
| Property | Type | Description |
|---|---|---|
| Profile | SpawnProfile | Source profile (set on spawn) |
| Wave Index | int | Wave this entity belongs to |
| Is Alive | bool | Current alive status |
| Defeat Reason | DefeatReason | Why entity was defeated |
| Use Stats Health | bool | Integrate with GC2 Stats |
| Health Attribute | string | GC2 Stats attribute name |
Methods
| Method | Description |
|---|---|
| Defeat(DefeatReason) | Marks entity as defeated |
| Despawn() | Returns entity to pool |
| ResetTracker() | Resets for pool reuse |
Events
| Event | Description |
|---|---|
| OnDefeated | Fired when entity is defeated |
| OnDespawned | Fired when entity returns to pool |
PathAnchor
Scene ComponentWaypoint node for path-based movement. Supports branching and wait times.
Properties
| Property | Type | Description |
|---|---|---|
| Next Anchors | PathAnchor[] | Connected waypoints |
| Selection Mode | NextAnchorSelection | First, Random, Weighted |
| Wait Time | float | Pause at this waypoint |
| Speed Multiplier | float | Speed modifier for next segment |
| Reach Radius | float | Distance to consider reached |
Methods
| Method | Description |
|---|---|
| GetNextAnchor() | Returns the next anchor based on selection mode |
| HasNext() | Returns true if more anchors exist |
PathFollower
Scene ComponentMakes entities follow path anchors with configurable movement settings.
Properties
| Property | Type | Description |
|---|---|---|
| Movement Speed | float | Base movement speed |
| Rotation Speed | float | Turn speed toward target |
| Smooth Movement | bool | Interpolate for smoother motion |
| Look Ahead | bool | Rotate toward next waypoint early |
| Is Active | bool | Currently following path |
| Current Path Index | int | Current waypoint index |
Methods
| Method | Description |
|---|---|
| Initialize(PathAnchor) | Sets starting anchor |
| SetPath(PathAnchor) | Changes current path |
| StartFollowing() | Begins path movement |
| StopFollowing() | Stops path movement |
| Pause() | Pauses movement |
| Resume() | Resumes movement |
Events
| Event | Description |
|---|---|
| OnPathCompleted | Fired when reaching path end |
| OnWaypointReached | Fired at each waypoint |
| OnBlocked | Fired when obstacle detected |
UI Components
SWS includes optional UI components for displaying wave status:
WaveStatusUI
Displays current wave number, progress, and alive/defeated counts.
WaveAnnouncerUI
Shows wave start/complete announcements with fade animations.
EntityCountUI
Simple counter showing remaining entities.
NextWaveTimerUI
Countdown timer between waves.