Skip to content

Getting Started

This page walks you through importing the template, opening the sample scene, and running the project.


Requirements

  • Unity: version 2021 LTS or later
  • Scripting Backend: .NET 4.x
  • NavMesh: baked for the main terrain where units can walk

Folder structure

The core template code lives under something similar to:

Assets/RTS/
  Scripts/
    Core/
    Data/
    UI/
    AI/

Typical layout:

  • Core: gameplay logic (buildings, units, selection, combat, game manager)
  • Data: ScriptableObject definitions (BuildingType, UnitType, ResourceType, etc.)
  • UI: in-game UI logic (BuildingUIManager, SelectableManager, unit info panels, etc.)
  • AI: simple enemy behavior (EnemyUnitAI, EnemySpawnerBuilding)

Opening the demo

  1. Import the package into a new or existing Unity project.
  2. Open the included demo scene (for example: RTS_DemoScene.unity).
  3. Press Play.

In the demo scene you can typically:

  • Select the Town Center or other production buildings.
  • Queue workers / units via the UI.
  • Place new buildings using the build buttons.
  • Assign workers to resource buildings.
  • Spawn simple enemy units from an enemy base and watch them react.

Input basics

By default, the template uses:

  • Left Click:
  • Click on a building or unit: select it
  • Drag on the ground: multi-select units inside a rectangle
  • Right Click:
  • On the ground: move selected units
  • On an enemy unit / building: order selected units to attack

The input mapping is handled primarily by:

  • UnitSelectionController (selection, drag box, right-click commands)
  • SelectableManager (central selection state)
  • BuildModeController (when in building placement mode)

Layers & NavMesh

For the systems to work as expected, you should configure these elements:

  • Ground / Terrain:
  • Must be on a layer that is included in the groundLayerMask of UnitSelectionController and the building placement raycasts.
  • Must have a baked NavMesh so units can move.

  • Units & Buildings:

  • Player units and buildings should be on layers used by selection & targeting.
  • Enemy units and buildings should be on separate layers if you want to:
    • Select only friendly units
    • Use LayerMask filters for AI targeting