Skip to main content
‹ Back to Tutorials
Intermediate Unity

Unity 3D + Playmaker - EASY Mech Shooter Projectile & Sound

Feb 20, 2022
About this tutorial

In this mini Unity 3D + Playmaker tutorial part 2, I'll show how to set up a Mech Shooter projectile & sound. The projectile, I'll set up as a prefab, have it move, and create it on screen. Then I'll add sound to both fire and when projectile hits. Files - Mech Arm and Projectile Prefabs: https:/

Written Guide

The mech shooter gets its firepower in this tutorial: a projectile that launches from each arm's barrel, streaks across the scene with a rocket trail, explodes on impact with a particle blast, and cleans up after itself — plus fire and explosion sounds to sell it all.

Anatomy of the projectile

The projectile is an empty containing three parts. A trail particle system gives the rocket feel: duration 0.3, simulation space set to world so particles hang in the air where they were emitted, and size over lifetime shrinking each particle as it dies. The bullet is a slightly elongated sphere. The blast is a second particle system using an emission burst of 100 particles — and it starts deactivated, because it should only play on impact.

Move and detect the hit

Add an FSM to the projectile with a detect hit state. A Translate action moves it 20 on the Z axis, per second, every frame — hard-coded, pushing it away from the player. Add a Collision Event watching the bullet specifically (it has the collider), which needs a Rigidbody on the bullet with use gravity unchecked — unless you want arcing shots that eventually drop. On collision, send a bullet hit event to a new state.

Explode and clean up

The bullet hit state swaps visuals with three Activate Game Object actions: deactivate the trail particle system, deactivate the bullet, and activate the blast. Then a 0.6-second Wait gives the blast time to play before a destroy self event moves to a final state with a Destroy Self action — otherwise spent projectiles pile up in the scene forever. One more safeguard back in detect hit: a 15-second Wait that also goes to destroy self, so shots fired into the sky don't fly on eternally.

Spawn from the barrels

In the gunfire manager, where each fire state already plays the arm animation and waits 0.2 seconds, add a Create Object action creating the projectile at the arm 1 spawn point (no parent needed). Copy it into the second fire state and switch the spawn point to arm 2. Test: both arms now launch live rounds.

Add the sound

Firing without audio is anticlimactic. In the gunfire manager, add a Play Sound action with a gun blast clip in each of the two fire states. Then open the projectile prefab and add another Play Sound in the bullet hit state with the explosion clip. Fire, streak, boom — the mech shooter finally sounds like one.

Unity tools by Bliz Studio
Built for our own games — now on the Asset Store

Multi Tag — unlimited hierarchical tags for any GameObject. Hierarchy Pro — style your whole hierarchy with rules. Made by a Unity dev, for Unity devs.

Explore our Unity assets →