Random Explosions around Gameobject on Death

I’m trying to make deaths look a little better, rather than just one explosion and a fade out.

I want to spawn explosion effects in random places around my gameobject’s surface. The way I thought about doing it, was using some pre-determined areas placed around my gameobject, then spawning a random explosion from a list of prefabs in a random unit in sphere around that area…

But i want it to also only spawn a few here and there, short little “bangs” (which of course I have). The whole situation only lasts about 5-10 seconds. So theyll pop pop pop all over while it spins out of control, then at the very end one bigger special made effect with a nice little shockwave or something to finish it off.

I was going to do this in an enumerator, and have a while loop that started over every random range within a second, (so play 5-10 times based on length of said “death” ). And maybe instantiate a random as well from 1-10 explosions per shot. Then of course the last one at the end, when the gameobject is removed.

Thoughts? Ideas? Better ways?

The first thing i thought of was “Particle System”. You have all there that you need: Number of particles, spread, sub-particle-systems and a burst at the end.

If that’s not feasible, then i would replace the normal gameObject, if it is to die, with an object thats prepared for destruction. The destructable object would have, as you mentioned, predefined areas, where explosions can occur, would have some parts, that could fly away, would have some particle systems, that pull off smoke or sparkles and an explosion object for the end explosion.

If you put all this information on your standard gameobject, you have a lot more clutter in your normal game that does for the worst reduce your performance with things you don’t need. If your gameObject dies, delete it immediately and replace it with a new prefab that does all that dying without your further intervention.