Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. NPC Factions
  4. NPC Building Regulator Data

NPC Building Regulator Data

The NPC Building Regulator Data is responsible for regulating the creation of one or multiple building types for one or multiple NPC types, one or multiple of faction types or a combination of those two.

To create a new NPC Building Regulator Data, right-click with the mouse in the project tab and click on: Create -> RTS Engine -> NPC Building Regulator Data. An asset file will be then created, select it and define the new building regulator fields.


  1. Min Amount Range: Minimum amount that must be created from the building type.
  2. Max Amount Range: The maximum allowed amount that can be created from the building type.
  3. Max Pending Amount: The maximum allowed amount of this building-type-creation tasks that the faction can have at the same time.
  4. Create On Demand: Allow NPC components (other than the NPC Building Creator) to request the creation of this building type.
  5. Start Creating After (in seconds): The creation of this building type will start after the delay provided in this field.
  6. Spawn Reload Range (in seconds): The timer length that will be used by the NPC Building Creator to decide whether to create this building type or not.
  7. Regulate Per Building Center: When enabled, the building’s minimum and maximum amount values will only be considered for the buildings that belong to the same building’s center territory (a building center is a building with the Border component). When disabled, then the min and max amount values will be considered for the whole NPC faction’s territory.
  8. Placement Option: Determines how the building will be placed. There are three options:
    1. Around Center: Building will be placed around the building center that it belongs to.
    2. Around Building: Building will be placed around a certain building.
    3. Around Resource: Building will be placed around a certain resource type.
  9. Placement Option Info: Depending on the chosen Placement Option, this field will different interpretations. In the case of:
    1. Around Center: You can keep this field empty.
    2. Around Building: Input the code of the building that you want this building to be placed around.
    3. Around Resource: Input the name of the resource type that you want this building to be placed around.
  10. Build Around Distance: defines the minimum distance between this building type & its build around object.
  11. Rotate: When enabled, the NPC faction will rotate the building towards its building around object.

Now that we have a NPC Building Regulator Data asset file in the project tab, let’s use it for a building type. Select a building prefab and open its Building component and open the Regulator Data property of the building in the inspector and you should now see this view:

Here you can assign a NPC Building Regulator Data to be used for all NPC types and faction types. Or you can use different regulator data for one or multiple NPC types, one or multiple of faction types or a combination of those two. For example, the Warehouse building in the demo game uses one regulator data file for all faction and NPC types.


Now that we know how to create regulator data assets for units and buildings, it’s time to go back to the NPC Manager prefab and start modifying the NPC component which regulate how the NPC faction will act during a game.

How can we help?