Skip to content

Extending the Template

This template is designed to be extended.
Here are some common extension points and how to approach them safely.


Adding a new resource

  1. Create a new ResourceType ScriptableObject.
  2. Set ID, display name, icon.
  3. Add the new resource to:
  4. Building costs
  5. Unit costs
  6. Storage buildings
  7. Update your UI to display the new resource.

Adding a new building

  1. Create the building prefab:
  2. Add the Building component (derives from Damageable).
  3. Add UnitProducer / ResourceProducer / EnemySpawnerBuilding as needed.
  4. Create a BuildingType asset:
  5. Assign prefab references, cost, icon, name.
  6. Add a build button linked to this BuildingType in the build UI.

Adding a new unit

  1. Create the unit prefab:
  2. Add Unit (and configure NavMeshAgent).
  3. Add Attacker if the unit can fight.
  4. Add EnemyUnitAI only if it is an AI-controlled unit.
  5. Create a UnitType asset:
  6. Set display name, icon, prefab, population cost.
  7. Add the UnitType to a UnitProducer on a building.

Custom commands & abilities

To add abilities:

  • Create an Ability system on units or buildings.
  • Use hotkeys or UI buttons to trigger abilities.
  • Integrate with SelectableManager to know which entity receives the command.

Examples:

  • Special attacks
  • Area-of-effect spells
  • Build orders for worker units

Improving AI

To extend AI:

  • Add more states to EnemyUnitAI (Idle, Patrol, Chase, Attack, Flee).
  • Introduce a simple state machine or behavior tree.
  • Create an enemy game manager that builds structures, triggers attack waves, etc.

Design your extensions in separate namespaces and folders so the core template can still be updated or reused in future projects.