Hitbox Component

The Hitbox component enables an object to receive damage and interact with the Health system. It works in tandem with the Health component to apply incoming DamageData such as from projectiles or explosions to a specific target.

🎯 Purpose

  • Detects damage through colliders
  • Multiplies incoming damage using a configurable scalar
  • Sends the result to a connected health or damage processing system

🧱 Setup Instructions

  1. Add the Hitbox script to any GameObject that contains a Collider.
  2. Set the Damage Multiplier to scale damage for this body part (e.g. headshot = 2.0).
  3. Make sure a Health sits on the same GameObject or a parent. The hitbox finds it and forwards the damage automatically.
  4. Optionally hook the On Hit UnityEvent for hit VFX or sounds.

Note

To show damage numbers, hook On Hit to a Hitpoint component’s ShowDamage.

Note

You can add multiple Hitbox components across a character’s body (e.g., head, torso, limbs), each with its own multiplier.

πŸ“ Inspector Overview

FieldDescription
Damage MultiplierScales the incoming damage (e.g., 1.0 = normal, 2.0 = double damage)
On Hit (DamageData)Event triggered when this hitbox is struck, with the damage after the multiplier. The damage already goes to the parent Health; use this for effects or custom logic.

Note

A disabled hitbox ignores hits.

βœ… Ideal For

  • Player and enemy limbs
  • Armor weak points
  • Vehicles with destructible modules

Tip

Pair this with a Health component on the root GameObject to fully enable health loss, VFX triggers, and death logic.