Unity Sparks system

Everyone knows I love particles. And if you don’t then there’s something new to learn about someone every day.

But seeing as I like particles so much, I decided to try and see if I can get some nice realistic spark effects in Unity and succeeded after a couple of hours.

20131013213349

And because I’m nice, I’ll let you have the package:

DOWNLOAD THE UNITY PACKAGE FOR FREE BECAUSE I LOVE YOU

The way this was done was mostly trial and error and tweaking values in the particle system.

The way I did it was first create 2 GameObjects, 1 for the spark effect in the middle, and the other for the flying sparks.

Next, I added the particle emitter to the main spark one and stuck an additive particle material on it. I then set the particle emit rate to 60, the life time to something really low (the values are all in the unity package anyway) and a random rotation. Also to make it look better I added a size over lifetime so they sort of get bigger over 2 frames.

The second part was a cone shape emitter with a large emit rate, a bounce setting and the render type set to “Stretched billboard” so they all face the direction they go.

That’s the basics of it, but there’s a lot more to it like getting the gravity just right and the lifetime just right. These are all in the package but they will depend on your scene in the end so they will still need to be tweaked.

If you like, you could add smoke particles to a 3rd emitter to give it more of a burning effect. I actually recommend this, but smoke is another tutorial that I’m sure you can find somewhere else.

Anyway, I hope this helps someone out.

PS: you could use a “one shot” for both emitters and use it as bullets hitting a wall 😀

Amazing.

15 thoughts on “Unity Sparks system”

      1. Hey guys. Thanks for the interest.

        You should be able to drag and drop the .unitypackage into your unity assets.

        Once in there, there’s a prefab in Materials (accidentally, sorry) called “Sparks”. You just need to drag and drop that prefab into your scene.

  1. Thanks! Just learning Unity and wanted to play with getting particles to play when I want them to in the orientation I want them to (Specifically, if something collides with something else at X speed or higher, play sparks animation from collision point) and this looks far far better than the little orbs I had shooting out XD
    Really well done effect ^_^

    1. Hi woqho. Download the Unity package and simply drag and drop it into Unity. Then just drag the newly imported game object into your scene. From there you can tweak the options and move it around.

  2. Hello, I tryed your prefab : it is just amazing !!
    There is just a little problem : I had to resize your prefab and to reduce it’s lifetime, so I did it for the “cone of sparks” but I don’t find how to do it with the sphere.
    So I get a little cone for a very short time like expected and then a huge ball looping all the time.
    Could you help me ? How can I access the ball of fire in the inspector ?
    Sorry if you find my english terrible, it’s not my first language.

    1. Hello. Thanks for trying the prefab.

      The sphere and cone are different objects, so all you need to do is turn on the “one shot” on both the sphere and cone. You will also need to turn down the duration so it’s less than 1 second, like 0.1 or so. :)

      I don’t know what you mean about the ball of fire. If you mean a texture, then you should be able to get to it in the particle emitter options right down the bottom.

  3. Hello,

    First, thank you so much for your quick answer !
    The problem I have is that I don’t find how, in the inspector, to separate the two sparks systems.
    I get the feeling that you have two sparks mixed in one prefab because I managed to change the properties of one but I can’t change the other one’s.
    Here is an example : http://snag.gy/B2J1A.jpg
    This is what happens : I have a little cone that you can’t see on this screen because I managed to reduce it’s lifetime, but I didn’t manage to reduce the ball’s one.
    i also tried to delete the ball’s material directly in the “all materials” tab, but I get pink squares instead because Unity can’t find it.
    Again, thank you very much :)

    1. As you say : “The sphere and cone are different objects”, but there is only one prefab. And when I use the inspector in the prefab, I can only change the cone’s properties, I don’t find where the ball’s properties are.

      1. Ah okay. When you add the object to a scene, that’s the only way to edit it I think. Once you modify it, you can update the prefab. There should be a “Apply” button at the top of the properties panel. You can then delete it from the scene. I’m guessing you’re instantiating it.

        You can modify the material by clicking the “Renderer” section and clicking on the “Material” value.

  4. Hey there!

    This is probably an incredibly nooby question, but I’m trying to work out how to change what plane the sparks bounce on? Or any tips in how to make it hit the floor of my scene properly. It’s probably something I’m completely overlooking, but any help would be fantastic. :)

    1. Hey there.

      There should be a plane in the collision section of the particle emitter. You can move it around with the transform tools. However, I think it is somewhat limited that it has to be a plane. There may be a way to make it collide with the level, but you’d have to look into that elsewhere as I’ve never done it.

Leave a Reply

Your email address will not be published. Required fields are marked *