Introduction to Unity: Particle Systems

Unity’s particle system is both robust and feature packed. In this tutorial, you’ll learn the ins-and-outs of it to create both fire and explosions. By Anthony Uccello.

Leave a rating/review
Save for later
Share
Updated for Unity 2017.2 by Anthony Uccello. Original tutorial by Eric Van de Kerckhove.

Particle systems are like salt; just a small amount can add extra “pizzazz” to whatever you’re cooking up. Modern games that don’t use particle systems in some manner can feel quite bland.

Back in the old days, you needed the black arts of graphics programming to create even a single wisp of smoke. Thankfully, Unity makes creating particle systems quite simple with a modular, built-in particle system named Shuriken, which is easy to learn but lets you create complex effects.

In this tutorial, you’ll learn the following:

  • How to add a new particle system in Unity.
  • What the most commonly used particle system modules do and how to use them.

This tutorial has two main parts; in the first part, you’ll build the flames of a torch. In the second part, you’ll create a bomb explosion effect.

Note: This tutorial assumes you understand the basics of working with Unity. If you are new to Unity, or need a refresher, please see our Introduction to Unity tutorial.

Getting Started with Particle Systems

Download the starter project for this tutorial and extract it to a convenient location. Note that you will need to use at least Unity 2017.2 to work with this project.

Open up the Starter Project in Unity. The assets inside are sorted into several folders:

  • Materials: Holds the fire material.
  • Models: Contains the torch and bomb models and their materials.
  • Prefabs: Holds the bomb prefab.
  • Scenes: Contains the Torch and Bomb scenes.
  • Scripts: Holds the initial scripts.
  • Textures: Contains the texture for the fire material.

Now that you’ve seen where everything is stored, you can start to learn how particle systems work in Unity.

Adding a Particle System

A particle system generally emits particles in random positions within a predefined space, which can have a shape like a sphere or a cone. The system determines the lifetime of the particle itself, and when that lifetime expires, the system destroys the particle.

One nice thing about particle systems is that they are components that you can add to any GameObject in the scene. Want to have your sharks emit lasers from their eyes? Simply add a particle system to the shark eye GameObject, and your sharks will be unstoppable!

Open up the Torch scene from your Project Window and run the scene:

There’s not much going on at the moment. The torch hangs on the wall, but there’s no fire to be seen. You’ll need to add a particle system first.

Stop running the scene and select TorchFireParticles inside the Hierarchy. Inside the Inspector, click the Add Component button. Search for Particle System and click to add it:

The Add Component screen with Particle System in the search field

Note: You might have noticed you didn’t add the particle system directly to the MedievalTorch GameObject. This is because the particles would be emitted from the middle of the torch, instead of from the fuel container at the top.

Play your scene; you’ll see you have particles emitting already:

Torch with particles emitting from it

Correct settings from the particle system's Renderer section

Note: You might see pink particles instead of white, which seems to be a Unity bug with setting the default texture. If that’s the case, don’t worry: you will set the proper fire texture shortly. If you’d like to fix it now, click the Renderer section of the particle system, click the Dot next to the Material field and double-click Default-Particle in the window that pops up.

Correct settings from the particle system's Renderer section

When you select a GameObject with an attached particle system, you’ll notice a black dialog in the lower right-hand corner of the scene view. This dialog lets you simulate or stop the particle system. Clicking Simulate activates your particle system and changes the button to a Pause button. To stop the simulation, click the “Stop” button.

Dialog with stop, start and pause buttons

This dialog is useful for designing particle systems that run on a fixed timeline, such as explosions.

A Closer Look at a Particle System

Take a look at the Inspector. You’ll notice the particle system Component you added has several subsections:

How the particle system Component looks in the Inspector

Each of these subsections is called a Module. These Modules contain the settings for the particle system. The Module expanded by default is known as the Main module:

Main module showing the particle system

The Main module is the meat and bones of any particle system in Unity. The most common particle settings live here:

On & off

On & off

For your fire effect, leave this disabled to make it look like the torch was just ignited.

Top: 8 seconds
Bottom: 3 seconds

Set the lifetime to 4 seconds; this ensures the flame won’t be too tall.

Top: 2
Bottom: 10

Set the speed to 0.75; this will make the fire effect slower and more dense.

  • Duration: The length of time in seconds for the particle system to run. Leave this at the default value of 5.00.
  • Looping: Repeatedly emit particles until the particle system stops. The cycle restarts once the Duration time is reached. The fire needs to burn continuously, so leave this enabled.
    Difference between looping on (left) and off (right)

    On & off

  • Prewarm: Only used when Looping is enabled. The Particle System will act as if it’s already completed a full cycle on start-up.
    Difference between prewarm on (left) and off (right)

    On & off

    For your fire effect, leave this disabled to make it look like the torch was just ignited.

  • Start Delay: The delay in seconds before the particle system starts emitting. Leave this at the default value of 0.
  • Start Lifetime: The initial lifetime in seconds for the particles. The particle is destroyed after this elapsed time.
    Start lifetime of 8 seconds (top) and 3 seconds (bottom)

    Top: 8 seconds
    Bottom: 3 seconds

    Set the lifetime to 4 seconds; this ensures the flame won’t be too tall.

  • Start Speed: The initial speed of the particles. The greater the speed of the particles, the more spread out they will be.
    Difference between a start speed of 2 (top) and 10 (bottom)

    Top: 2
    Bottom: 10

    Set the speed to 0.75; this will make the fire effect slower and more dense.

Difference between looping on (left) and off (right)

On & off

Difference between prewarm on (left) and off (right)

On & off

Start lifetime of 8 seconds (top) and 3 seconds (bottom)

Top: 8 seconds
Bottom: 3 seconds

Difference between a start speed of 2 (top) and 10 (bottom)

Top: 2
Bottom: 10

Note: As you modify the settings of the particle system, you’ll see a preview of it in the Game Window. Keep an eye on this preview while following along with the tutorial.

Before continuing, run your scene to see the effect of your changes:

Torch emitting particles after the changes you made above

You’ve set up the torch, but the fire effect still leaves a lot to be desired. Thankfully, the Main module has additional options to further refine the shape and behavior of your torch.