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
- Add
Healthto the root of your player, enemy or prop. - Set Health to the starting value. It’s also the maximum.
- 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
| Field | What it does |
|---|---|
| Health | Starting and maximum health |
| Destroy On Death | Removes the object when health reaches zero. Turn it off for players you want to respawn |
| On Health Changed | Sends health from 0 to 1 every time it changes. Use it for a health bar |
| On Damage Data Received | Sends the hit or heal that changed health. Use it for damage numbers |
| On Death | Fires once when health reaches zero |
🎮 Actions
Call these from code or from any UnityEvent:
| Method | What 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.