SuperTiled2Unity icon indicating copy to clipboard operation
SuperTiled2Unity copied to clipboard

Replace tileset on runtime

Open EskemaGames opened this issue 5 years ago • 2 comments

Hi, is there any way to replace the whole tileset on runtime?. Imagine a game with day and night. I want to be able to change the whole tileset to change the sprites (without changing the map).

So far I don't see any clear way to do that. Is that possible?, any tip to search the code for such change myself?.

Thanks!

EskemaGames avatar Jan 28 '20 08:01 EskemaGames

I believe that if you want to change a single tile, you'd get the reference to the Tilemap component and change it there.

If you want to change the whole map, I think you may need something custom. Maybe have some intermediate format where tile #0 can reference two tilesets (day or night) tileset.

There may be a "better" way.

ijacquez avatar Feb 09 '20 22:02 ijacquez

Changing a couple of tiles is not a big deal, you get the tilemap, and call the set tile. But I'm talking about pointing to a new .tsx file. When we import a map.tmx we also import a reference to a tileset.tsx and that's what I'm after. How to point to a new .tsx file and do a "reload". But doesn't seems to be an easy way to do it without messing a lot with the current code. I was asking cause maybe I didn't find the proper spot to do it :)

EskemaGames avatar Feb 10 '20 07:02 EskemaGames