Recently, I made some pretty cool basic explosion effects in Unity using mostly their built-in particle systems. I was going after a cool top-down 2D explosion effect, and it came out pretty nicely:
After a little more work on some scripts to cause several explosions to go off on a timer, some modifications to the prefabs to get explosions of different sizes, and some small debris objects being spawned with the explosion, it all starts to come together:
Today, I’m here to share with you the basics of how I set up these particle effects. If you want, here’s a direct link to a UnityPackage containing all the resources I’ll be using to build my basic particle explosion. Feel free to download that and browse the effect settings yourself.
There’s four particle systems that combine to make this explosion effect. First off is the fire particles which spawn from the ParticleSystem component on the base of the Explosion object. Here’s a look at the ParticleSystem component settings:
There’s a lot here to look at. Let’s start with the basic settings. I set the duration of the system to 3 and turned looping off. The lifetime of the particles is set to be a random between two constants so all the fire particles don’t disappear at once, but fade out at different random times. I also randomized the start speed for a more interesting look, and while I didn’t randomize the starting rotation it looks good to have that done as well. I also changed the stop action to “Destroy”, so that the particle system will destroy itself when all its particles are done and no more are to be produced. I changed the emission module from a constant rate over time emission to a large burst of particles. The emission shape is a circle (as I’m working in 2D space), and I’ve set the “Randomize Direction” parameter to 1, so each particle goes off in a random direction instead of simply going away from the middle. This makes for a more natural burst shape with the fire. The high initial velocity of the particles is set to be dampened with the Limit Velocity over Lifetime module, which gives the effect of an initial burst of motion that slows as it expands. The particles also fade out over time thanks to the Color over Lifetime module. Perhaps the coolest part of this flame particle is that it’s an animated texture. The Fire material is a simple Additive Particles material (tinted orange) with this texture attached:
The ParticleSystem’s Texture Sheet Animation module handles animating textures. Since the texture has three columns and two rows, putting X=3 and Y=2 and setting the animation to “Whole Sheet” while having a linear curve in the “Frame Over Time” box works to animate the texture as it’s applied to the particle over its lifetime.
The Fire particle system also has a Sub Emitter linked to the “Smoke” particle system on Birth. Here’s what the Smoke ParticleSystem component looks like:
It’s very similar to the Fire particles in most respects, although some of the settings are slightly numerically different. They start with a higher velocity and end with a lower velocity, and have a longer lifetime. They also have some settings in the “Size over Lifetime” module so that they expand a bit over their lifetime as they fade out. It also uses a different material with the Particles/Multiply base, as I couldn’t get dark looking particles with any other settings.
The other two particle effects are really quite simple. Here’s the important bits of the Shockwave ParticleSystem component:
It’s just a large, textured particle that gets larger and fades out over time. The sparks are a bit more interesting:
They are small dot particles that start at a very high speed and burst outwards in a circle. The interesting bit is that these are rendered in stretched billboard mode with a speed scale, which is why they look like long streaks at the beginning then go towards dots as they slow down.
Putting all four of the particle effects together results in a pretty decent looking explosion effect. If you missed it at the top, here’s the link to the UnityPackage with the basic explosion particle effect set up! Hope you find this interesting and useful!