Seanba / Tiled2Unity

Export Tiled Map Editor (TMX) files into Unity
Other
495 stars 120 forks source link

Importing a new map reimports prefab of older map #136

Open Joimer opened 6 years ago

Joimer commented 6 years ago

I've been using tiled2unity without any problems until now, but on my seventh map, when I import it to my project, it changes the tileset of two previous maps using a different tileset.

It's as follows: first_level.tmx using first_tileset.tsx second_level.tmx using second_tileset.tsx third_level.tmx using third_tileset.tsx fourth_level.tmx using third_tileset.tsx fifth_level.tmx using fourth_tileset.tsx sixth_level.tmx using fourth_tileset.tsx seventh_level.tmx using fifth_tileset.tsx

When I import the seventh level, fifth and sixth levels start using the fifth tileset as well. If I reimport either, both will go back to the fourth tileset, but then the seventh level will be using fourth tileset too instead of fifth.

What can be causing this issue?

Joimer commented 6 years ago

I've found the exact problem: if the two original png files have the same name even though they are in a different route, when importing the same png file will be used. Problem was fixed when I changed one of the png file name.

Seanba commented 6 years ago

FWIW, Tiled2Unity does have a way to deal with name collisions should you have the same texture name coming from different paths in your tilesets.

http://tiled2unity.readthedocs.io/en/latest/prepostfix/

This will allow you set prefix and/or postfix strings to the textures that get exported to Unity.