Health Component

The Health component is a simple script used to give any object in the game a health value. It is meant to be placed on the root GameObject of the entity (such as a player, enemy, or destructible object).

Warning

A Hitbox componenet is required to make the health function on the object

❤️ Purpose

This component manages:

  • A numeric health value
  • Health change notifications via UnityEvents

🧱 Setup Instructions

  1. Attach the Health script to the root of your object.
  2. Optionally hook into the On Health Changed event to update health bars, trigger effects, or run custom logic.
  3. Add a hitbox component anywhere in the hieratchy where there is a collider

📐 Inspector Overview

FieldDescription
HealthThe current and maximum value of health
On Health Changed (Single)Triggered when health is updated. Useful for linking to UI elements like sliders or images.

Tip

You can use the event On Health Changed to control UI and sounds

✅ Ideal For

  • Enemies
  • Players
  • Destructible props or objects
  • Boss fights