Simple Duck
Scene: DuckShooter_SimpleDuck
The smallest setup: one big duck with a health bar hovers in front of your ship. Shoot it until it pops.
flowchart LR
A["Bullet (25)"] --> B["Hitbox x0.2"] --> C["Health 200"]
C --> D["Health bar"]
C --> E["Damage number"]
C -->|"reaches 0"| F["Death effect"]
Each bullet deals 25, and the hitbox’s multiplier of 0.2 turns it into 5, so the duck takes 40 hits.
🦆 The Duck
Everything sits on one GameObject, the DS_Ducky model:
| Component | Setup |
|---|---|
Health | 200, Destroy On Death on |
Sphere Collider + Hitbox | Multiplier 0.2 |
Hitpoint | Shows the damage from the health’s On Damage Data Received |
SpawnableEffect | Spawns DS_DuckDeathEffect where each hit lands from the hitbox’s On Hit, and where the killing blow lands from On Death |
DSHover | A gentle hover |
The health bar is a UI slider set from On Health Changed.
Note
The Hitbox is added by hand only to set the 0.2 multiplier. Without it, Health would add one with multiplier 1 on its own collider.
Tip
Start here: it shows Health, Hitbox, Hitpoint and SpawnableEffect working together on a single object, with no game logic around them.