Hitpoint

The Hitpoint spawns a floating number, such as the damage of a hit or +25 from a health pickup. The number faces the main camera and is destroyed after its lifetime.

🧱 Setup

  1. Add Hitpoint to the object that should show numbers, usually the one with the Hitbox or Health.
  2. Assign a Hitpoint prefab with a TextMeshPro text on it or a child. The package includes one in CommonAssets/Prefabs/Hitpoint.prefab.
  3. Hook a hitbox’s On Hit to Hitpoint.ShowDamage.

📐 Inspector Overview

FieldDescription
LifetimeSeconds before the number is destroyed
HitpointThe number prefab, with a TextMeshPro text

⚙️ How It Works

  flowchart LR
    A["On Hit"] --> B["ShowDamage"] --> C["Floating number"]

🎮 Methods

MethodDescription
ShowDamage(DamageData)Shows the rounded damage at the hit point, or at this object when the damage has no hit point. Ignores damage of zero or less
ShowText(string)Shows any text at this object’s position, for example +25 or Blocked

Tip

Give the prefab a small animation that floats up and fades out, matching the Lifetime.