The Particle System component helps you create cool effects like fire, smoke, or rain in your game. It makes many small images move and change to look like natural things.
Particle System component in Unity
Add a Particle System component to a GameObject in Unity. You can control it using the Inspector or by scripting: // Example to start the particle system in C# ParticleSystem ps = gameObject.GetComponent<ParticleSystem>(); ps.Play();
You add the Particle System component from the Unity Editor by selecting a GameObject and clicking Add Component > Effects > Particle System.
You can control many settings like emission rate, speed, size, color, and lifetime of particles.
// Create a Particle System in the Editor and start it ParticleSystem ps = gameObject.GetComponent<ParticleSystem>(); ps.Play();
// Stop the Particle System ParticleSystem ps = gameObject.GetComponent<ParticleSystem>(); ps.Stop();
// Change particle start color var main = ps.main; main.startColor = Color.red;
This script controls a Particle System on the same GameObject. It starts the particles when the game begins. Pressing the space bar will toggle the particle system on and off, and messages will show in the console.
using UnityEngine; public class SimpleParticleController : MonoBehaviour { private ParticleSystem ps; void Start() { ps = GetComponent<ParticleSystem>(); if (ps != null) { ps.Play(); Debug.Log("Particle system started."); } else { Debug.Log("No Particle System found on this GameObject."); } } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { if (ps.isPlaying) { ps.Stop(); Debug.Log("Particle system stopped."); } else { ps.Play(); Debug.Log("Particle system started."); } } } }
Remember to add a Particle System component to your GameObject before using this script.
You can customize the particle effect in the Unity Editor to get different looks.
Use the Debug.Log messages to see what is happening when you press keys.
The Particle System component creates many small moving images to simulate effects like fire or smoke.
You add it to a GameObject and control it with the Inspector or scripts.
You can start, stop, and change particle properties using simple C# commands.