In this quick article I am going to over how to create animated tiles in tilemap in Unity.
How to install the package
The first step is to import “2D TileMap Extras” from the Package Manager. I am using Unity 2020.3.18f1 so I will have to enable Preview Packages in the Project Settings (some later beta version have this installed already be default).
You do this by going to “Edit” > “Project Settings” > “Package Manager” and under “Advanced Settings” ticking the checkbox “Enable Preview Packages”. Now you can find and install the 2D TileMap Extras package from the package manager.
How to set up the animated tiles
Download your sprite that you will be animating. I have a waterfall that I will use, which has left, right and center sprites. I will be slicing the tiles the same way I did in my previous article — set the sprite type to multiple, adjust the pixels per unit and slicing by cell size.
I will create a child folder under my tiles folder called “Animated”. In this folder I will create the animated tile asset by clicking “Create” > “2D” > “Tiles” > “Animated Tile”.
Next we can drag all the sprites into the asset to animate them, taking care to set the minimum and maximum speed (at the moment its set to 1 frame a second).
Next create a new palette and drag the tiles into it (I go over this in detail in my previous article).
Next step is to paint the tile into the scene like you would any other tiles.
Now we can see the final results.
That's all for now.