Effects
Three small helpers for sounds and effects. Hook them to the events of Health, Hitbox or Health Pickup.
| Component | What it does |
|---|---|
| Sound Generator | Plays a random sound at a random pitch |
| Spawnable Effect | Spawns an effect prefab |
| SelfDestruct | Removes an object after a few seconds |
For example, the ducks in the examples die like this: On Death calls a Spawnable Effect, which spawns a splash. The splash’s Sound Generator plays a squeak, and its SelfDestruct removes it after 2 seconds.
🔊 Sound Generator
Add Component: Glowing Rifts > Misc > Sound Generator
| Field | What it does |
|---|---|
| Audio Source | The source to play through. Uses the one on this object if empty |
| Sounds | Clips to pick from at random |
| Pitch Range | Lowest and highest random pitch |
| Play On Enable | Plays as soon as the object appears. Turn it on for effect prefabs |
Call Play() from an event, such as a hitbox’s On Hit.
✨ Spawnable Effect
Add Component: Glowing Rifts > Misc > Spawnable Effect
| Field | What it does |
|---|---|
| Effect | The prefab to spawn |
Call Spawn() to spawn it at this object, or Spawn(DamageData) to spawn it where a hit landed.
⏳ Self Destruct
Add Component: Glowing Rifts > Misc > SelfDestruct
| Field | What it does |
|---|---|
| Lifetime | Seconds before the object is removed |
Put it on effect prefabs so they clean themselves up.
Tip
Step by step: Add Sounds and Effects.