CodeBlanks Logo Icon CodeBlanks

What is a Particle System?

Learn that a Particle System manages many small particles.

What is a Particle System?

Instead of manually modeling visual effects (VFX) like smoke, fire, sparks, explosions, or rain with individual 3D models, Unity uses the ParticleSystem component. This system generates, moves, and destroys thousands of small 2D or 3D particles in a GPU-friendly manner.

ParticleSystem ps = GetComponent<ParticleSystem>();
Debug.Log("Particle count: " + ps.particleCount);

Main Module and Core Properties

The Particle System has a modular structure. The top-level main module manages the overall duration of the system (duration), whether it loops (looping), and the particle lifespan (startLifetime). When looping is enabled, the system continuously repeats.

var main = ps.main;
main.loop = true;
main.startLifetime = 3.0f;

Practice Read Particle Count

Assign ps.particleCount to variable sayi and print it with Debug.Log("Parcacik: " + sayi);.

Starter code

Player.cs
using System;

public class ParticleSystem
{
    public int particleCount = 150;
}

public static class Debug
{
    public static void Log(object message) => Console.WriteLine(message);
}

public class Program
{
    public static void Main()
    {
        ParticleSystem ps = new ParticleSystem();
        // Parcacik sayisini alip konsola yazdir
    }
}

Sample solution

Player.cs
using System;

public class ParticleSystem
{
    public int particleCount = 150;
}

public static class Debug
{
    public static void Log(object message) => Console.WriteLine(message);
}

public class Program
{
    public static void Main()
    {
        ParticleSystem ps = new ParticleSystem();
        int sayi = ps.particleCount;
        Debug.Log("Parcacik: " + sayi);
    }
}

Expected output

Parcacik: 150

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which component is used in Unity to create visual effects like fire, smoke, or explosions using thousands of small particles?

  • ParticleSystem Correct answer
  • BoxCollider
  • AudioSource
  • MeshRenderer

Explanation: Unity's ParticleSystem component is used for visual particle effects.

2 Get ParticleSystem Component

Question
ParticleSystem efekt = GetComponent<____>();
Answer
ParticleSystem efekt = GetComponent<ParticleSystem>();

Explanation: To manage visual particle effects, the ParticleSystem component is retrieved.

3 Particle Basics

Term Meaning
ParticleSystem Component managing particle effects
VFX Abbreviation for visual effects
looping Endless loop of particle generation
startLifetime Particle lifespan in seconds

All lessons in Intermediate