Health

Health gives an object a health value that goes down when it’s hurt, up when it’s healed, and kills the object at zero.

Add Component: Glowing Rifts > Modular Health > Health

🧱 Setup

  1. Add Health to the root of your player, enemy or prop.
  2. Set Health to the starting value. It’s also the maximum.
  3. Hook the events to your health bar, effects or game logic.

If the object has one collider on the root, that’s all you need: Health adds a Hitbox to it automatically.

📐 Settings

FieldWhat it does
HealthStarting and maximum health
Destroy On DeathRemoves the object when health reaches zero. Turn it off for players you want to respawn
On Health ChangedSends health from 0 to 1 every time it changes. Use it for a health bar
On Damage Data ReceivedSends the hit or heal that changed health. Use it for damage numbers
On DeathFires once when health reaches zero

🎮 Actions

Call these from code or from any UnityEvent:

MethodWhat it does
Kill()Kills the object right away
ResetHealth()Refills health and brings the object back to life
Spawn(GameObject)Spawns a prefab at the object, for example an explosion from On Death

💡 Good to Know

  • Health never goes below zero or above the maximum.
  • Damage goes through modifiers such as Invincibility. Healing doesn’t.
  • A dead object ignores damage and healing until you call ResetHealth().

Tip

Step by step: Give an Object Health, Show a Health Bar and Handle Death and Respawn. For Hurt, Heal and the rest of the API, see the scripting reference.