Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Units
  4. Unit Spawner

Unit Spawner

The Unit Spawner component allows you to spawn a unit or multiple unit types in one or more spawn positions depending on its configurations in the inspector.

  1. Units: Drag and drop the unit prefabs (that have the main Unit component). Each time, one random unit will be chosen from this list to be spawned next.
  2. Player Faction: Check this field if you want to spawn the units for the player’s faction.
  3. Faction ID: If the above field is left unchecked, then the spawned units will be assigned to the faction whose ID is the value of this field.
  4. Free Units: Check this field if you want the spawned units to be free (not belong to any faction in the game).
  5. Update Population: The spawned units will occupy slots in their faction’s population, if this field is enabled.
  6. Spawn Positions: An array of Transform components placed in the map’s scene that represent the potential spawn positions of each unit. Each time a unit is spawned, a random element of this array is selected to spawn the units at.
  7. Destination: When assigned, unit that spawn will proceed to move towards the position represented by the Transform component.
  8. Amount Range: The minimum and maximum amount of instances of the units to spawn. A random value will be chosen at the beginning inside the assigned range.
  9. Spawn Reload Range: How long does it to spawn two consecutive units? Each time a unit spawns, the spawn reload value is chosen as a random value inside the assigned range.
  10. Game Manager: Since this component is not directly initialized by the Game Manager component, it has to be manually assigned through this field.

How can we help?