Particle Effects

Big Ideas:

  • "Particle System" is a component you can add to a GameObject that can fire out thousands of "particles" with tons of controls
  • These can look like:
    • Explosions, fireworks, dust going poof, laser beams, lava bursts, fireflies, snow, rain, dust drifting through the air ... and soooo much more.
  • A few basic controls you can tweak:
    • Where/what shape do they emit from? (emit from a line/cone in a single direction? or from the center of a circle going out in all directions?)
    • Burst or steady rate?
    • Size, color, speed, rotation at start ... as well as their values over time.
    • Images/objects to use as particles - could be as simple as circles, or complex artwork

  • Big idea - The more you play with these, the more you can add those polishing touches to your project to make your scenes come alive

Getting Started:

I really recommend following this short 7 minute tutorial on making a simple snowfall by BlackThornProd. The video introduces many of the basic ideas of particle systems much better than I could right here. Watch this first, then continue.

Some Great Resources:

Website Tutorials

"Creating 2D Particle Effects in Unity" - A website tutorial from Feb 2018, created by David Finseth. The tutorial Goes over more of the how and why you are using it, then some basics of what to use and when.

"Introduction To Unity: Particle Systems" - A website tutorial from Mar 2018, created by Anthony Uccello & Eric Van de Kerckhove. It is focused on 3D particle effects, but goes through specific iterations of getting a fire working and a bomb explosion. It also goes into a lot more detail about some of the important settings.

Unity Official Materials:

Free Assets

Particle Pack by - This package includes 80 sprites for particles, light cookies and shaders. Also includes a Unity package with particle effect samples (fire, smoke, magic, hearts, sparks and electricity). This guy makes tons of free assets and he is awesome.

Reddit Posts

Video Tutorial - Reddit Post - Text explode into small particles to disappear. A brief tutorial showing how you can create text to particle effect in Unity

YouTube Videos

"Dust Effect when Running & Jumping in Unity [Particle Effect]" (6min, Sep 2019) by Press Start. This is a GREAT video that shows how to make a quick dust effect when Mario changes directions (skids) and when he jumps. Super quick, clear, and helpful.

"How to Make 2D Particle Effects" (7min, May 2018) by BlackThornProd. Very similar to the above video about snow, but with some differences and highlighting different options. Love this guy's videos.

"2D Snow Effect in Unity" (4min, June 2018) by Waldo (aka PressStart). A super quick intro to make a super simple snow particle effect (not nearly as thorough as the one above, but a great quick intro).

3D Particle System Videos

"Everything to know about the PARTICLE SYSTEM" (10min, Feb 2018) by Brackeys. This is a great walkthrough of many of the most important options when setting up your first 3D particle systems.

"Unity VFX - Interactive Fireflies w/ Sound + Stinging (Particle System Tutorial)" (25min, March 2018) by Mirza. This is a rad video that shows how to make little glowing fireflies that swirl and flitter around a light, interacting with and bouncing off a knight that walks under it.

"Unity 2017 Tutorial - Sparks Particle Effect" (18min, Mar 2018) by LMHPoly. This is an awesome deep dive into making high quality 3D sparks particle effects. His videos have no talking, just super chill music as he slowly walks through the process. Love his videos and the end quality of this is awesome.

Code Snippets:

1. Play a single, non-looping particle system. Example: An explosion happens.

Remember: This is a component on a GameObject. So the particle system will play on that GameObject, at its location.

2. Enable or disable a looping particle system - Example: Turn a jetpack on, or turn the jetpack off based on whether a person is holding down the "Jump" button.

3. Create an explosion GameObject - This is less efficient as it creates/destroys an entire GameObject in memory, but is ok for a beginner or in a small project. You can simply get a nice prefab GameObject that has only a Transform component and a Particle System component. Get the explosion just right. Then you can use the code below to instantiate that explosion whenever, and wherever you want.

Note #1: At the bottom of the top, main Particle System options, select: Stop Action --> Destroy. This means that once your particle system is done playing, it destroys the GameObject it was on.

Note #2: Instead of this, you could put the explosion on the GameObject that you already have running around your scene that will explode. When it is time to explode, you could do something with the SpriteRenderer like disable it or switch sprites, then activate the ParticleSystem. You can set the Stop Action to be Disable or Destroy depending on the situation.

4. Edit Particle System During Run Time - You can edit any individual pieces of your ParticleSystem while it is running. Anything that shows up in the inspector window can be accessed via code, and particle systems are no different.

Option #1 - Explore the default commands embedded in the ParticleSystem class, such as: Start, Stop, Pause, Emit ... etc (Link to Unity Documentation)

Option #2 - Get the module (like GetComponent), and sets its values manually (shown below)