Unity RTS Engine

  1. Home
  2. Unity RTS Engine
  3. Buildings
  4. Building Health Component

Building Health Component

The building’s parent object must have the Building Health component attached to it. This is the component that handles the building’s health settings.


  1. Maximum Health: Maximum health points for this building.
  2. Hover Health Bar Y/Height: When moving the mouse over a building’s object, a health bar would appear. This is the health bar’s position on the y axis.
  3. Can Be Attacked: If disabled, then enemy factions will not be able to target this building to be attacked.
  4. Take Damage: if disabled, then enemy factions will be able to target this building to attack it but the building will not receive any damage from the attacks.
  5. Destroy Object: When disabled, the building’s object won’t be destroyed when the building has zero health
  6. Destroy Object Time: After how much time (in seconds) should the building’s object be destroyed after it hits zero health (if the above option is enabled).
  7. Destruction Award: This array allows the faction that destroyed this building to get resources as a reward. The resource types and their respective amounts can be assigned inside this array.
  8. Destruction Audio: Audio clip played when this building is destroyed.
  9. Destruction Effect: When the building is destroyed, this effect object will be shown on the building’s position.
  10. Construction States: The construction states allow to visualize the progress of the building’s construction by showing/hiding different child objects of the building depending on its current health. The states must be added in the order such that a state of index i has a health interval that is higher than a state of index j where j > i. Each state (element of the array) has the following fields
    1. Health Range: If the building’s current health while it’s being constructed is inside this range, then the building is in this construction state.
    2. Show And Hide Objects: When the building enters this construction state. Then objects in the Show Child Objects array field will be activated and objects in the Hide Child Objects array field will be hidden.
  11.  Complete Construction State:
    1. Health Range: Not applicable in this field.
    2. Show And Hide Objects: When the building’s initial construction (after placement) is complete, then objects in the Show Child Objects array field will be activated and objects in the Hide Child Objects array field will be hidden.
  12. Building States: The building states (only active if the building has been already fully constructed) allow to visualize how much the building is damaged by showing/hiding different child objects of the building depending on its current health. The states must be added in the order such that a state of index i has a maximum health bound that is higher than a state of index j > i. Each state (element of the array) has the following fields
    1. Health Range: If the building’s current health post-construction is inside this range, then the building is in this state.
    2. Show And Hide Objects: When the building enters this state. Then objects in the Show Child Objects array field will be activated and objects in the Hide Child Objects array field will be hidden.

How can we help?