The Health component allows any object to take damage inflicted by another object. This component can be added to any object to give that object health – whether that be a character or an inanimate object such as a barrel. The health component does not require any other components to work.
The Health component has two types of health – standard health that does not regenerate and health that does regenerate (called a shield). Both types of health are not required. For example, an object can only use its shield if it has a MaxHealth value set to zero.
When the health and shield values reach zero the object is considered dead. When the object dies it will spawn any objects in the SpawnedObjectsOnDeath array and deactivate if DeactivateOnDeath is enabled. In addition, the OnDeath and OnDeathDetails events are executed which notifies interested objects that the object has died.
An object can take damage by calling the Damage method. This method takes three parameters: an amount, position, and force. The amount specifies the amount of damage to take. If the object has both health and a shield then the amount will be subtracted from the shield first. The position and force parameters specify where the damage occurred and how much force was applied. This information is used by the GUI for the hit indicators and the ragdoll if the object died and has a ragdoll attached.
Health can be added by collecting the Health Pickup.
Is the object invincible? If true no damage will be taken
The maximum amount of health, can be 0
The maximum amount of shield, can be 0
Shield Regenerative Initial Wait
If using a shield, the amount of time to initially wait before the shield regenerates
Shield Regenerative Amount
If using a shield, the amount to regenerate every interval
Shield Regenerative Wait
If using a shield, the amount of time to wait before regenerating a small amount of shield
The list of colliders that should apply a multiplier when damaged
Spawned Objects On Death
Any object that should spawn when the object dies
Destroyed Objects On Death
Any object that should be destroyed when the object dies
Deactivate On Death
Should the object be deactivated on death?
Deactivate On Death Delay
If DeactivateOnDeath is enabled, specify a delay for the object to be deactivated
The layer that the GameObject should switch to upon death
Time Invincible After Spwan
The amount of time that the object is invincible after respawning