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 fol...
public class TopDownCamera : MonoBehaviour
{
[SerializeField] private float panSpeed = 20f;
[SerializeField] private bool enableEdgeScroll = true;
[SerializeField] private float zoomSpeed = 5f;NavMesh Click-to-Move
Click-to-move character controller using NavMeshAgent. Click anywhere to navigate, with destinati...
[RequireComponent(typeof(NavMeshAgent))]
public class NavMeshClickToMove : MonoBehaviour
{
private NavMeshAgent agent;
public void MoveTo(Vector3 destination)Minimap System
Render texture minimap with player icon, enemy blips, objective markers, and zoom control.
public class MinimapSystem : MonoBehaviour
{
public static MinimapSystem Instance { get; private set; }
public static void RegisterIcon(Transform target, Color color, float scale = 1f)
public void ZoomIn()
public void ZoomOut()Wave Spawner
Wave-based enemy spawner with configurable wave definitions, spawn points, delays, and wave compl...
public class WaveSpawner : MonoBehaviour
{
[System.Serializable]
public class Wave
{
public string waveName = "Wave";
public EnemySpawn[] enemies;
}
private IEnumerator SpawnWave()Health System
Reusable health component with damage, healing, invincibility frames, and events.
public class HealthSystem : MonoBehaviour
{
[SerializeField] private float maxHealth = 100f;
public float HealthPercent => currentHealth / maxHealth;
public void TakeDamage(float damage)
public void Heal(float amount)Waypoint Patrol AI
Enemy patrol between waypoints with configurable speed, wait times, and patrol patterns (loop, pi...
public class WaypointPatrol : MonoBehaviour
{
public enum PatrolMode { Loop, PingPong, Random }
[SerializeField] private Transform[] waypoints;
[SerializeField] private float moveSpeed = 3f;
[SerializeField] private PatrolMode patrolMode = PatrolMode.Loop;Health Bar UI
World-space or screen-space health bar with smooth fill, color gradient, and damage flash. Attach...
public class HealthBarUI : MonoBehaviour
{
[SerializeField] private float smoothSpeed = 5f;
[SerializeField] private Gradient colorGradient;
public void SetHealth(float current, float max)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.