Seanba / SuperTiled2Unity

Imports Tiled files to Unity. Better than regular Tiled2Unity.
MIT License
648 stars 83 forks source link

Replace tileset on runtime #124

Open EskemaGames opened 4 years ago

EskemaGames commented 4 years ago

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!

ijacquez commented 4 years ago

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.

EskemaGames commented 4 years ago

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 :)