Unity VFX: Creating Enemy Explosions

Special effects in Unity? No problem. See how easy it is to implement enemy explosions.

  1. Create an animation for the Enemy object.
  2. Open the animator window and add new empty state, set it as the default.
  3. Add a transition from the empty state to the animation and add animator trigger parameter.

4. Finally, write code to activate the trigger when the enemy is destroyed.

Look at the purple parts of the code, they are responsible for setting the trigger when the laser hits the enemy. You just need the animation, the animator trigger and a few lines of code to make the explosions work.

--

--

Damian Dąbrowski

Hi, I’m Damian, a Software Engineer who loves building educational apps and simulations..