Health System

The Health System makes it easy to not just set up destructible vehicles and objects of all kinds, but also create damageable parts on a bigger vehicles, such as capital ships.

The two core components of the Health System are:

  • Damageables

  • Damage Receivers

  • Health Modifiers

  • The Health component

Damageables

A Damageable component represents an object which can be damaged (or healed). This component has a specified Health Type you can set in the inspector, and has a health value which can range from zero to a specified maximum value.

Add a Damageable component for any object (or part of a vehicle) that you wish to be damaged by weapons or collisions.

Damage Receivers

When a weapon such as a projectile or a beam hits a damageable object, it searches for a Damage Receiver component on the same game object as the collider. This enables it to efficiently pass damage (or healing) information to the Damageable that the collider represents.

Add a Damage Receiver component to the game object of every collider representing a Damageable object.

The Damage Receiver is basically a channel for passing damage (or healing) information through the collider to the Damageable.

Health Modifiers

Health Modifiers are added to bullets, missiles, explosions or anything else that is capable of damaging something.

See the Setting Up Weapons Damage section for more information.

The Health Component

The Health component may be added to the root transform of an object which has one or more Damageables. It has several key functions:

  • Storing information about all the Damageables on the object, for easy access by other scripts.

  • Enables easy switching on/off of whether all the Damageables on the object are damageable or healable.

  • Enables collisions to cause damage.

Add a Health component to the root transform of an object to manage its health from one place.

NOTE: A Health component is required for any object that can be damaged by collisions.