Lesson 39 +10 XP

Particle System Component

Particle System Component

Unity's Particle System component (sometimes called Shuriken) is a CPU-based tool used to create fluid effects like fire, smoke, sparks, and rain.

Core Modules

A Particle System is configured via modular panels in the Inspector:

  • Main Module: Controls global settings (duration, looping, start lifetime, start speed, start size, gravity modifier).
  • Emission: Controls how many particles are spawned. You can set a constant rate (e.g. 50 particles per second) or create a Burst (spawning 100 particles at once, ideal for explosions).
  • Shape: Controls the spawning area shape (e.g. Cone, Sphere, Box, Circle).
  • Size over Lifetime: Shrinks or grows particles as they age.
  • Color over Lifetime: Fades particles out or changes their color over time using a gradient editor.
  • Renderer: Defines the material and sprite/mesh used to draw the particles.

Playing Particles in C#

You can play and stop particle systems via code:

public class Fireplace : MonoBehaviour
{
    private ParticleSystem particles;

    void Start()
    {
        particles = GetComponent<ParticleSystem>();
    }

    public void LightFire()
    {
        particles.Play();
    }

    public void Extinguish()
    {
        particles.Stop();
    }
}

TL;DR

  • Shuriken Particle System is a CPU-based component for fluid effects.
  • Adjust parameters via modules like Main, Emission, Shape, and Renderer.
  • Burst emissions are useful for one-time impact effects.
  • Use Play() and Stop() methods in scripts to trigger effects.