Animated Tile Sets in Unity
Showing how we can animate some Tilemaps in Unity
Objective: Go over how we can achieve animated Tilemaps in Unity.
In order to get animated tilesets in Unity, we first need to import the Unity 2D Extras Github package. Be sure to grab the proper version of the package as noted in the ReadMe. For example, I am using Unity 2019.4 so I had to grab my package at the 1.5.0-preview tag. For use in Unity 2021+, you can download the package through the Package Manager. Once the package is installed in Unity, we can go ahead and start animating tiles in Unity.
For this example, we will be creating a waterfall tilemap animation. With the 2D Extras package installed, we can now create Animated Tilemaps. Create an Animated Tilemap as you would any other object in Unity. For the waterfall I will be creating, there are three different animations I need to create. One animation for the left edge of the waterfall, one animation for the right edge of the waterfall, and one animation for the center area of the waterfall. My animation will be playing at 30 frames per second, and I have 30 frames to support it. When the Animated Tilemap has been created, you will select and in the Inspector you should see a window as shown below.
I already went ahead and entered everything I needed for my animation to work. For your animation, enter in the number of animated sprites you want the animation to use, and be sure to set the speed at which you want the animations to run. When done successfully, you should get a result as seen below:
That is all for today. Thank you for taking the time to read my article. In the next article, I will start setting our player character for this project.