Making Animated Tile Sprites in Unity

Bringing the Scenery to Life

Okay, maybe a little less life than that.

Welcome back. This is the second article in my series covering the creation of a Mobile 2D Adventure game in Unity.

Today I’m going to break down the steps to animating tile sprites for Unity’s tilemap system. To access this feature, you will need the Unity 2D Extras package. Make sure to download from the branch for the version of Unity you are using. I’m using 2021.1.

If you have the current version of Unity, you’ll want to use the master branch.

Installing the repository can be tricky, as there are multiple options depending on your needs. Check the readme in the repository for detailed instructions. I imported it as a package because I know I’ll be using other features later, but all you really need to follow along with this article is the AnimatedTile script somewhere in your Project tree.

Now for the fun part.

First we need to create an Animated Tile asset in the Project tree:

Then, select all the animation sprites for your tile from the Project tree and drag them into the box in the Inspector (you may need to lock your Inspector on the Animated Tile asset to select the sprites).

Finally, in your Tile Palette, drag the Animated Tile asset into the palette area. It can now be used as a brush to pain the scene as normal. When the scene is run, the tiles will animate. You can adjust the FPS of the tile in the Inspector. It defaults to 1 frame per second — I have 30 frames so I’ll adjust the Minimum Speed to 30.

Let’s see how it looks:

That black line near the top of the waterfall only exists on my capture monitor. Weird, huh?

Not bad.

I hope you found this little tour useful. Tomorrow I’ll set up yet another character controller, this time using Unity’s Rigidbody Physics to propel the player.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store