Seanba / Tiled2Unity

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

Problem importing tmx from Tiled 1.0.2 #127

Closed CaldwellYSR closed 7 years ago

CaldwellYSR commented 7 years ago

Everytime I try to import my tmx file I get this error Data at the root level is invalid. Line 1, position 1.

My tmx file was created from a CSV map (it seems xml isn't an option anymore in 1.0.2?) and Tiled2Unity is trying to parse it as XML

Seanba commented 7 years ago

Hi Caldwell, are you exporting your Tiled map as a CSV file and then trying to load that in Tiled2Unity? Unless something major went down I'm pretty sure TMX files are still well-formed XML.

CaldwellYSR commented 7 years ago

@Seanba When creating a new map with Tiled 1.0.2 XML isn't one of the options for "Tile Layer Format". I did save the file as a TMX file and it failed repeatedly. When going into the map properties you can select "XML" for Tile Layer Format just not when creating a new map. Once I selected XML the import/export worked correctly.

After that, I created another new TMX that was smaller (in tiles) than the previous one and even with CSV Tile Layer Format it imported and exported without any issues. I'm not sure what caused it to fail for me the first time.

Seanba commented 7 years ago

Oh, I get it. You're talking about the format of the layers within a TMX file. Tiled2Unity should handle all the layer formats available.

Do you still have the TMX file that isn't working? I'd like to get my hands on it and see what was up with it.

CaldwellYSR commented 7 years ago

No I actually don't... Once I changed the Tile Layer Format to XML it started working and changing it back to CSV doesn't break it. In all honesty I probably closed Tiled and Tiled2Unity in between making that change as well so it could have been a glitch that worked itself out when I closed the program. Sorry, this might have been a false alarm.

Seanba commented 7 years ago

Okay. Don't sweat it. If you get this to happen again though please send me the file. :)