Animated Tile Sets in Unity

Objective: Create Animated Tiles.

Thanks to our last few tutorials we know how to make Tilemaps, Palettes, and how to slice sprites into tiles. We are going to use this knowledge to create animated tiles.

I have three sprites I’m going to use. These sprites are to make a waterfalls.

I’m going to slice these by 256 x 256 making 30 tiles for each.

Before we can continue we need to add 2D Extras to our unity project. Open you web browser of choice and click HERE. This will take you to Github. Select the drop down on the branches and select the Unity version you are using.

Now we need to download these files.

Extract the files to your desktop

Now you can drag this file into your project.

From here we can continue on. Before we can add those tiles we created earlier to a palette, we want to make sure it is already animating. Instead of adding all these individual sprites, we are adding an animating tile to the palette so we are painting with an animated sprite.

Create a folder under our tiles folder, mine is named “Animated Waterfall”

Right click the new folder > Create > 2D > Tiles > Animated Tile

I have 30 sprites, I need to set the number of animated sprites on the inspector to 30.

Go to your sprite and the only way I am currently aware of to attach these tiles to the animated sprite is to drag one by one, in order into the inspector.

I repeat for all three sprites. With this done we can create a new palette named “Animated Waterfalls” and drag in the three animated tiles.

Use the edit tool to arrange these into the correct order.

We now need a new Tilemap. Create a Tilemap for the Foreground, and set the Order in layer to 3.

With the foreground Tilemap as the active Tilemap, select the water fall and pain it into the environment.

If you played the editor at this point the waterfall would fall at 1 fps. To set the speed select the animated tiles in the project view and at the bottom of the inspector set the minimum and maximum speed to 30 for each animated tile.

This is it! We have successfully created animated tiles. We can paint these waterfalls wherever we need them and they will animated at 30fps. Don’t be afraid to experiment with your animated tiles and I’ll see you in the next tutorial!