Build an RTS Game
Top-down camera, click-to-move navigation, unit selection, minimap, and wave spawning for real-time strategy.
Learning Path
Follow these steps in order to build your RTS Game.
Included Scripts
Top-Down Camera
RTS/strategy camera with WASD panning, edge scrolling, scroll wheel zoom, and optional target follow.
- WASD/arrow key panning with configurable speed and smoothing
- Edge-of-screen mouse scrolling with adjustable zone size
- Scroll wheel zoom with min/max limits and smooth interpolation
NavMesh Click-to-Move
Click-to-move character controller using NavMeshAgent. Click anywhere to navigate, with destination marker and path line.
- Click-to-move navigation using Unity NavMeshAgent
- Visual path line rendered with LineRenderer component
- Destination marker prefab spawned at click position
Minimap System
Render texture minimap with player icon, enemy blips, objective markers, and zoom control.
- Render texture-based minimap with dedicated orthographic camera
- Automatic player following with optional rotation-match
- Dynamic icon registration and unregistration for any tracked object
Wave Spawner
Wave-based enemy spawner with configurable wave definitions, spawn points, delays, and wave completion callbacks.
- Configurable wave definitions with multiple enemy types per wave
- Multiple spawn points with automatic round-robin distribution
- Adjustable delay between spawns and between waves
Health System
Reusable health component with damage, healing, invincibility frames, and events.
- Damage and healing with clamped health values
- Invincibility frames with configurable duration after taking damage
- UnityEvent callbacks for health changed, damaged, healed, and death
Waypoint Patrol AI
Enemy patrol between waypoints with configurable speed, wait times, and patrol patterns (loop, ping-pong, random).
- Three patrol modes: Loop, PingPong, and Random
- Configurable move speed, rotation speed, and arrival threshold
- Wait timer at each waypoint with adjustable duration
Health Bar UI
World-space or screen-space health bar with smooth fill, color gradient, and damage flash. Attach to enemies or use as HUD.
- Smooth fill animation with Lerp for satisfying health changes
- Color gradient that shifts from green to yellow to red automatically
- Damage flash effect on the background image when health decreases
Related Systems
RTS Starter Kit
Real-time strategy foundation with camera, click-to-move navigation, unit selection, minimap, and wave spawning.
Enemy AI Kit
Complete enemy AI pipeline: state machine, patrol, chase, health, and wave spawning with debug visualization.