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
- Add
Hitpointto the object that should show numbers, usually the one with theHitboxorHealth. - Assign a Hitpoint prefab with a TextMeshPro text on it or a child. The package includes one in
CommonAssets/Prefabs/Hitpoint.prefab. - Hook a hitbox’s On Hit to
Hitpoint.ShowDamage.
📐 Inspector Overview
| Field | Description |
|---|---|
| Lifetime | Seconds before the number is destroyed |
| Hitpoint | The number prefab, with a TextMeshPro text |
⚙️ How It Works
flowchart LR
A["On Hit"] --> B["ShowDamage"] --> C["Floating number"]
🎮 Methods
| Method | Description |
|---|---|
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.