Seanba / Tiled2Unity

Export Tiled Map Editor (TMX) files into Unity
Other
499 stars 121 forks source link

Tiled2Unity: “Object reference not set to an instance of an object” #175

Open baynebrannen2 opened 6 years ago

baynebrannen2 commented 6 years ago

I keep getting this error every time when trying to export my .tmx file into Unity:

Object reference not set to an instance of an object

This happens when I try to load the file into Tiled2Unity. It does export successfully to Unity, but it’s all messed up. I read on a past issue that it had to do with tile files being changed location. As much as I tried to reconfigure and reload the tilesets I had on my map nothing worked.

So I just started an entirely new map and remade approximately what I had. It still has the same error. I have four layers–a Main layer (with simple house, path, and grass tiles), two object layers (one the door, one the roof), and a collision layer.

Only the Main layer seems corrupted when it imports into Unity.

Seanba commented 6 years ago

Hi there. Where are you seeing the error? In the export utility or in Unity? Can you send me the output? I may be able to figure out what has gone wrong based on stacktrace.

baynebrannen2 commented 6 years ago

Hi! I'm seeing it in Tiled2Unity for Mac.

Here's the full output (I think, let me know if this is not what you meant):

Loading summary
Succeeded: 1
  Parsed: /Users/----/Desktop/RPG/Outside.tmx 
Warnings: 0
Errors: 1
  Skia Library exception: Object reference not set to an instance of an object
    Stack:
  at Tiled2Unity.TmxImage.FromXml (System.Xml.Linq.XElement elemImage, System.String prefix, System.String postfix) [0x00101] in <6883ba762f2b47a9a00ea12d8a51d00b>:0 
Seanba commented 6 years ago

This looks like the error that will disable previewing in the exporter. So, although inconvenient, it should still allow you to see your map in your Unity project. You mentioned the Main layer being corrupted. Can you explain that a bit more or maybe post a screen shot?

dtomvan commented 5 years ago

I made a map with tiled: image

then i put it in unity with supertiled2unity.

in unity , the only i can see is the following:

image

so nothing is imported

on the left you can see whats in my map named "home"

on the lower side of the screen you can see the error.

Can anyone help me with this?

Seanba commented 5 years ago

Hi there, @18gatenmaker. This appears to be a SuperTiled2Unity bug but this is the (old and deprecated) Tiled2Unity repository.

However, if you click on your lake or home files you should see some information about the errors in the inspector - including a "Copy Errors to Clipboard" button so that you can report the issue in full.