Hi
I’m working on a season system for my game, which is a 2D RPG based on unity’s built in tilemap system. Part of my season system is to change the tiles so they are recolored to match the season. I have over 1000 different tiles so it isn’t feasible to attach a script to each one individually to handle this-- it would simply be too much effort and probably too many scripts running. There’s two main ways I can think of to handle this:
One is to simply have different tilemaps for each season, and enable/disable them as neccessary. While this is super simple on the scripting end and allows a bit more creative freedom, I’d like to avoid this as I have a very big game world and am a one person team, so having to redo the entire world for each season is a lot of work and room for error.
The way I’d like to achieve this is to simply change the texture the tilemaps themselves render from. I’ve already finished the spritesheets for them and they’re essentially recolors of eachother, with a couple other tiny changes. All of the tiles are in the same location on the sheet, so I don’t see why this wouldn’t work.
I tried to do this by using terrainTilemap.sharedMaterial.SetTexture as well as .mainTexture, and while this caused a visual change to the material in the editor, it didn’t change anything in the game window. I guess I can see why it didn’t work as you can draw from multiple images on each tilemap. I also tried to see if I could somehow attatch a script to a Tile Pallette but unless I’m missing something that’s not possible.
Is there some other easy way I can achieve this? I was thinking maybe having seperate spritesheets for each season, then having a fifth spritesheet that the Tile Pallette is based off, which I then modify the image directly during runtime. I have no experience with this though and am unsure of if it would work.
If it’s relevant, the changes to the tilemaps will happen while my player is in a bed and the screen is black, so if there’s any visual weirdness or slowdowns while it happens it really wouldn’t affect the gameplay experience.
Thank you for any help!