Our review
Wave spawning system for Tower Defense and survival games using ScriptableObject configurations.
Strengths
- Uses ScriptableObjects for designer-friendly configuration without code
- Clear separation between controller, config, and spawner logic
- Encourages object pooling for performance
- Customizable waves with spawn rate and enemy types
Limitations
- Requires a separate object pooling system implementation
- Does not handle enemy behavior after spawning
- No built-in difficulty scaling across waves
Use this pattern for any game requiring timed, scripted enemy waves (Tower Defense, Horde Mode).
Avoid if your game does not need structured waves or uses event-based non-timed spawning.
Security analysis
SafeThe skill provides game development design patterns with C# code examples. It does not instruct any destructive, exfiltrating, or unsafe operations. The allowed tools (run_command, list_dir, write_to_file) are typical for a coding agent and are not misused in this context.
No concerns found
Examples
Create data for a wave. Use a ScriptableObject with fields for enemy prefab, count, and spawn rate.Write a coroutine that spawns a wave of enemies with a configurable delay between each spawn.name: horde-wave-logic description: "Wave spawning system for Tower Defense and Survival games. Configurable waves, enemy types, intervals, and difficulty scaling." version: 1.0.0 tags: ["spawner", "horde", "waves", "enemies", "tower-defense"] argument-hint: "action='StartWave' config='Wave1' OR spawn='Zombie_Fast'" disable-model-invocation: false user-invocable: true allowed-tools:
- run_command
- list_dir
- write_to_file
Horde & Wave Logic
Overview
Manages the pacing and spawning of enemy units. Uses ScriptableObjects to define wave configurations, allowing designers to tweak difficulty without touching code.
When to Use
- Use for Tower Defense games
- Use for "Horde Mode" survival
- Use for timed enemy assaults
- Use for testing combat balance
- Use for creating "Boss Waves"
Architecture
┌─────────────────────────────────────────────────────────────┐
│ WAVE CONTROLLER │
├─────────────────────────────────────────────────────────────┤
│ │
│ WAVE CONFIG (Asset) SPAWNER (MonoBehaviour) │
│ ┌────────────────┐ ┌───────────────────────────┐ │
│ │ Wave 1: │ │ State: Waiting/Spawning │ │
│ │ - 10 Zombies │─────▶│ Timer: 30s │ │
│ │ - Rate: 0.5s │ │ Coroutine: SpawnLoop() │ │
│ └────────────────┘ └─────────────┬─────────────┘ │
│ │ │
│ ▼ │
│ OBJECT POOL ┌───────────────────────────┐ │
│ ┌────────────────┐ │ Instantiate / GetFromPool │ │
│ │ Zombie Prefab │◀──────│ Set Position (SpawnPoint) │ │
│ └────────────────┘ └───────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Best Practices
- ✅ Use Object Pooling for enemies (Critical for performance).
- ✅ Define Waves as
ScriptableObjects(List of Waves). - ✅ Include "Warmup" time between waves.
- ✅ Support multiple Spawn Points.
- ✅ Implement "Wave Cleared" logic (Track active enemy count).
- ❌ NEVER Instantiate enemies during the loop without pooling.
- ❌ NEVER use
InvokeRepeating(hard to control); use Coroutines.
Few-Shot Examples
Example 1: Wave Config Data
User: "Create data for a wave."
Agent:
[CreateAssetMenu]
public class WaveData : ScriptableObject
{
public GameObject EnemyPrefab;
public int Count;
public float SpawnRate;
}
Example 2: Spawner Logic
User: "Spawn the wave."
Agent:
IEnumerator SpawnWave(WaveData wave)
{
for (int i = 0; i < wave.Count; i++)
{
SpawnEnemy(wave.EnemyPrefab);
yield return new WaitForSeconds(wave.SpawnRate);
}
}
Related Skills
@object-pooling-system- Required for spawner@unit-population-ai- AI for spawned units@unity-events-messaging- "Wave Start/End" events
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.