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. Destroy 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 maximum health bound that is higher than a state of index j > i. Each state (element of the array) has the following fields
    1. Max Health: If the building’s current health while it’s being constructed is lower than this, then the building is in this construction state.
    2. Show And Hide: Assuming that the building is currently in this construction state, there are two cases: If enabled then objects in the Show Child Objects array field will be activated and objects in the Hide Child Objects array field will be hidden. If disabled then the object in the Child Object field will be simply activated as long as the building is in this construction state.
  11. 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. Max Health: If the building’s current health is lower than this, then the building is in this state.
    2. Show And Hide: Assuming that the building is currently in this state, there are two cases: If enabled then objects in the Show Child Objects array field will be activated and objects in the Hide Child Objects array field will be hidden. If disabled then the object in the Child Object field will be simply activated as long as the building is in this state.

How can we help?