Here Comes the Boom!

Triggering animations in Unity with the Animator

Valdarix Games

--

Explosion Effect

What’s a 2D retro game without some sweet sprite animations? We talked about animating sprites in a previous article. However, today we will have a look at the animation tools available in the Unity Game Engine that will allows us to create things like explosions on enemy’s we destroy using the animator.

The animation above is simple animation using only sprites, we will walk through creating a similar animation, setting up a game object to use it and we will even enhance it some to clean up rough edges.

Getting Started

First we will need a set of sprites to use in our animation. I am using sprites from GameDevHQ for the image above but for todays project we can grab a completely free set from OpenGameArt by clicking here.

Now that we have a sprite sheet we will need to make sure it is properly sliced. If you don’t know how to splice a sheet you can read about it here in my previous article on Sprites and Animations.

Proper Slice should look something like this in the project files.

OK, so now we have our sprite sheet, it’s nicely chopped up. What do we do with it? Well, first we are going to create an empty game object that will be prefabbed as for later usage.

Creating the Empty Game Object and renaming it.

Creating the Animation

With the prefab created and renamed we need to make it do something for us. Open the Animation Window from the menu (ctrl+6) if it is not already open. With our new Explosion Animation object selected in the Hierarchy the animation window should look like this:

No Animation Present

Click Create, give your animation a name and save it, preferably in some well organized project folders. Now the animation window should have updated to a state we can work with. You should see:

--

--

Valdarix Games

Turning my passion for video games and software development experience into a focus on video game development.