Featured Blog

Shooting Particles in Unity (For Beginners)

For my first Unity game, I wanted to experiment with particle effects and I soon found a way to make an avatar shoot out particle fireballs. The particles looked way better than any sprites I had in mind for laser fire. Here is how I did it.


     For shooter mode in TriGrid, bullet sprites just didn't cut it. They were boring crystal sprites that shattered on impact. I needed something with more flare. More Geometry Wars like. I started messing with Unity's particle systems and discovered how to make a little fire ball. One color change and explosion effect later I had the shooting effect I wanted. Here is how I got those "pew pew" thingies to work.



     I basically made a looping particle emitter in a cone shape using Unity's particle editor. I made it so the effect spawns up to 1000 dots that change from light blue to lavender as the die within one third of a second.





     I made the particle effect it's own object, attached physics to it, and made it a trigger so that it could collide with game objects. I attached a script I named scriptShot so I could control what happens when it impacts something. 




     If you wanted to replicate my effect, here are the settings to do it. Releasing 130 particles at a time with an initial extra burst of 50 every time the loop resets. I made them move at a speed of 100 to get the speeding effect I wanted.



     Stretching out the cone path that the particles were stuck inside was pretty simple. Unity has sliders you can adjust. To make the tail longer, all I'd have too do is increase the lifespan of each particle.



     This is the method I used to make the player shoot particles. This was called every time the "Pew" button was pressed. It checks to see if less than 4 shots are already in play before firing. I wanted to limit the amount of active shots to make things more challenging. The player could shoot once in each direction if necessary, but that's it. A skilled player could possibly last forever, but triangles tend to sneak up on you and catch your flank.



     This code changes the direction the player is facing. In Unity the transform.eulerAngles variable determines where an object is facing. I do this so I only have to tell the arrow to move forward when it's in motion. The player's direction determines which way the shot spawns and which way the shot moves.



     The shot only knows to go forward. At the moment of its creation it checks the direction of the player and aligns itself to match it.



     When it's in play, its just a matter of moving it by 4 pixels every frame in whatever direction it's facing. Based on the way the particles orient themselves, it moves by subtracting its Z-value on the coordinate plane.



     After that, it was just a matter of determining what happens when it touches stuff. I made it so enemies die on contact and walls trigger the particle effect within the particle effect that plays an explosion animation and deletes the original blast. After that I save the blast and the explosion as prefabs to be summoned whenever the player taps the "Pew" button. Suddenly, I have a Shooter mode in TriGrid.

Latest Jobs

Xbox Game Studios

Redmond, Washington
Technical Lighting Artist


Hamburg, Germany
Game Designer - Elvenar

Six Foot

Houston, TX
Six Foot Director, Player Relations

Hometopia Inc.

Lead Engineer
More Jobs   


Explore the
Subscribe to
Follow us

Game Developer Job Board

Game Developer Newsletter


Explore the

Game Developer Job Board

Browse open positions across the game industry or recruit new talent for your studio

Subscribe to

Game Developer Newsletter

Get daily Game Developer top stories every morning straight into your inbox

Follow us


Follow us @gamedevdotcom to stay up-to-date with the latest news & insider information about events & more