Hitbox

The Hitbox connects a collider to the Health system. Attacks hurt the hitbox, and the hitbox scales the damage and forwards it to the Health on its own GameObject or a parent.

🧱 Setup

  1. Add Hitbox to any GameObject with a Collider. The collider is required.
  2. Make sure a Health sits on the same GameObject or a parent.
  3. Set the Damage Multiplier for this part of the body.

Note

Add several hitboxes to one character (head, torso, limbs), each with its own multiplier. They all feed the same Health.

📐 Inspector Overview

FieldDescription
Damage MultiplierScales incoming damage. 1 is normal, 2 is double (a headshot), 0.5 is half (armor)
On Hit (DamageData)Raised every time this hitbox is hurt, with the damage after the multiplier. Use it for hit effects, sounds or damage numbers

⚙️ How It Works

  flowchart LR
    A["Hit"] --> B["x Damage Multiplier"] --> C["Health"]
    B --> D["On Hit"]
  • Damage is multiplied first, then sent to the Health, then On Hit fires.
  • A disabled hitbox ignores hits. Disable it to make one body part immune.
  • A hitbox without a Health above it still raises On Hit, which is handy for targets that only react to hits.

Tip

The Hitbox Boss example uses hitboxes with multipliers of 2, 1 and 0.5 to show weak and armored spots.