Animated Tilemaps for Unity 2020+
In the past, if you wanted to have animated Tilemaps in Unity, you had to go into Unitys github and manually download ‘Tilemap Extras’ and install it. Now you can install it directly from the package manager albeit with a few extra steps:
First you need to go to Edit/Project Settings/PackageManager and tick “Enable Preview Packages”
You’ll get a warning about how these are brand new options and that Unity won’t be responsible for any PCs catching on fire, giving up your first born to the elder gods blah blah, yada yada, click “I understand”.
Now when you go to the package manager, the tilemap extras will appear! Let’s click on install!
After a few seconds, the package will now be a part of your Unity development package and you’re ready to rock! Well, not yet actually. You may need to quit Unity and reload it for the package to initialize.
If for whatever reason this doesn’t work, we can do it the old way by Going to Unitys Github, https://github.com/Unity-Technologies/2d-extras , and downloading the code there.
Next, unzip the file, and open the packages folder of your unity project and copy the unzipped folder into it.
Next open the Readme.md and copy the json line
And paste the line to manifest.json:
A huge thank you to the Gamenomoly youtube channel for the info!
That said, I was still having issues getting the tile extras to work and I ended up just deleting everything and starting from scratch with a new clean project and was able to get it installed then using the package manager method. Moral of the story, Try to get all of your planned extensions in early at the beginning of your project.
Now that everything is prepared, we’re given a waterfall spritesheet that we slice into 256x256 sections
Now if we actually skim through our waterfall sprites, you can see how each frame is animated.
After preparing all 3 waterfall pieces, Waterfall Center, Left, and Right. We’re going to place them in the tile editor, but not each frame, we’re going to create an animated tile that holds all the frames and paint with that.
First in Sprites/Tilemap/Tiles, we create a Waterfall directory, and then rightclick create Animated 2D tile called Waterfall_Left.
Before, you had to drag every frame into the animated tile, but fortunately now you just need to drag the sliced sprite into it.
We then repeat the process for Waterfall_Center, and Waterfall_Right.
Next, we create a new Palette for the Waterfall tiles and place the tiles into it.
Next save the scene to make sure the palette settings are saved as well.
I made a new tilemap layer called waterfalls and changed the sorting layer to 3 and then painted waterfalls onto that.
Hitting play, we see the waterfalls animate, but only at 1 fps. Let’s speed it up.
if we select the waterfall tile, at the bottom of the inspector you’ll see a minimum and maximum speed. Just change the minimum speed to 30 for all 3 waterfall assets.
Much better! The waterfalls now animate at 30fps!
Let’s add a few more.
Tomorrow, we’ll talk about prefab brushes and colliders.