Tag Archives: particle

Adding a particle system to a 2D game in Unity

In this tutorial we will add a particle system to a 2D game in Unity. Particle systems emit particles in a game and can be used for adding a variety of effects like fire sparks, smoke, rain, and fog. We will use a particle system to emit spark effects.

Watch the video below to see how you can add particle systems to your own 2D game.

Next tutorial: Adding collectables and scoring

Particle Systems in PlayCanvas

This video tutorial explains how to add particle systems to your PlayCanvas game. A particle system allows you to add a range of animated effects such as smoke, fog, bubbles, flames, and sparks.

Tip: You can also use an image for your particles by dragging an image that you have uploaded to PlayCanvas (eg. JPG or PNG image) onto the Color Map property on the particle system in the Inspector panel.

Particle systems in Unity

This video tutorial explains how to use particle systems in your Unity game and also an introduction on how to use C# scripts to control a particle system. Watch the video below and then scroll down to see the sample code.

The sample C# code below shows how to play or stop a particle system when a key is pressed. This code should be placed inside the Update() method.

 if (Input.GetKeyDown (KeyCode.E)) {
 if(gameObject.GetComponent<ParticleSystem>().isPlaying == true){
 gameObject.GetComponent<ParticleSystem>().Stop ();
 }
 else{
 gameObject.GetComponent<ParticleSystem>().Play ();
 }
 }