CodeBlanks Logo Icon CodeBlanks

Summary - Particle System

Reinforce Particle System usage with a summary task.

Particle System Summary

The Particle System is the foundation for visual effects (VFX) bringing game worlds to life. The main module sets lifetime (startLifetime), size (startSize), and rotation (startRotation); Emission controls spawning frequency, and Shape dictates emission bounds. The system is triggered from gameplay events via Play() and Stop().

ps.Play();
var em = ps.emission;
em.rateOverTime = 30f;

Practice Manage Particle System

Call ps.Play();. Then print system status with Debug.Log("Aktif: " + ps.isPlaying); and Debug.Log("Hiz: " + ps.rate);.

Starter code

Player.cs
using System;

public class ParticleSystem
{
    public bool isPlaying = false;
    public float rate = 50f;
    public void Play() { isPlaying = true; }
}

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

public class Program
{
    public static void Main()
    {
        ParticleSystem ps = new ParticleSystem();
        // Sistemi baslat ve uretim hiziyla birlikte bilgileri yazdir
    }
}

Sample solution

Player.cs
using System;

public class ParticleSystem
{
    public bool isPlaying = false;
    public float rate = 50f;
    public void Play() { isPlaying = true; }
}

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

public class Program
{
    public static void Main()
    {
        ParticleSystem ps = new ParticleSystem();
        ps.Play();
        Debug.Log("Aktif: " + ps.isPlaying);
        Debug.Log("Hiz: " + ps.rate);
    }
}

Expected output

Aktif: True
Hiz: 50

Questions and answers

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

1 Which module and shape are used to cause particles to scatter evenly in all directions as a sphere during an explosion?

  • Color over Lifetime module - Gradient
  • Renderer module - Billboard
  • Emission module - Burst
  • Shape module - Sphere Correct answer

Explanation: The module that governs emission geometry and direction is Shape, and the shape scattering in all directions is Sphere.

2 Summary Stop Particle

Question
if (ps.isPlaying) ps.____();
Answer
if (ps.isPlaying) ps.Stop();

Explanation: To stop a running particle system, the Stop method is called.

3 All Particle System Concepts

Term Meaning
Emission Particles emission module per second
Shape Geometric area of particle emission
Color over Lifetime Particle color change over lifetime
Play() Starts the particle system via code

All lessons in Intermediate