Create Health and Damage Pickups
๐ฏ Goal
Make items that heal or hurt whatever touches them.
๐งฐ What You Need
- A GameObject with a collider
Health Pickup- A
Rigidbodyon the pickup or on the collector
๐ช Steps
Create the pickup object
Make a GameObject with a model and a solid (non-trigger) collider. Pickups work on collisions, and Unity only sends them when one of the two objects has a non-kinematic Rigidbody. If your player is kinematic or has no Rigidbody, give the pickup a Rigidbody, turn off Use Gravity and freeze its position and rotation so it stays in place.
Add Health Pickup
Add Add Component > Glowing Rifts > Modular Health > Health Pickup and set Amount. A positive amount heals, a negative one hurts.
Pick who can collect it
Set Collectors to the layers that can collect it, for example Player. The object it touches also needs a living Health on itself or a parent.
Choose if it stays
Keep Destroy On Collect on for health packs that are used up. Turn it off for hazards such as spikes or lava, which hurt again on every new touch.
๐ Inspector Settings
| Field | What it does | Set it to |
|---|---|---|
| Amount | Health change on collect. Negative hurts | 25 for a health pack, -25 for a damage pickup |
| Collectors | Layers that can collect the pickup | Your player’s layer |
| Destroy On Collect | Destroyed on collect and on colliders without a Rigidbody | On for packs, off for hazards |
| On Collected | Invoked with the collector | A sound, an effect or Hitpoint.ShowText |
๐งช Example
The Health folder has two ready-made pickups: Health Pickup (Amount 25, Collectors Player) and Damage (Amount -100, every layer, Destroy On Collect off).
In the Health Pickup scene, DS_HealthPickup (Amount 25) and its variant DS_DamagePickup (-25) rain down on the ship. Their On Collected shows +25 or -25 through a Hitpoint. The ship’s Rigidbody is kinematic, so each pickup has its own non-kinematic Rigidbody without gravity.
๐ก Tips
- A health pack is collected even when health is full. To leave it for later, write your own pickup that returns
falsewhenhealth.isFull. - With Destroy On Collect on, the pickup is also destroyed when it hits a collider without a Rigidbody, such as the floor. Falling pickups clean themselves up.
- Healing skips modifiers, but damage goes through
Health.Hurt, so Invincibility blocks damage pickups. Hitbox multipliers never apply.