Seanba / Tiled2Unity

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

Strange tile misalignment #145

Open zane49er2 opened 6 years ago

zane49er2 commented 6 years ago

The tiles are correct in tiled and the preview, but in unity, some of them are shifted over by a pixel. untitled

zane49er2 commented 6 years ago

It seems to actually be scaling these tiles, which are not configured differently to ones around them, and which are on the same layer. https://snag.gy/N7nwLg.jpg

Seanba commented 6 years ago

Are you talking about thee seams in between some of your tiles? This is common problem in Unity that I talk about a bit here: http://tiled2unity.readthedocs.io/en/latest/fixing-seams/

zane49er2 commented 6 years ago

These are not typical seams. the tiles are actually being scaled by a strange, random number. See the snaggy link - the tile is horizontally scaled to be smaller than the identically-configured ones around it.

Seanba commented 6 years ago

I think I get it now. What are you using for the orthographic size of your camera and how pixels wide/high do you want to be displayed in your view? You might want to toy with the pixel snapping option on the shaders too.

Texel biasing can cause issues like this so if you're using the -t or --texel-bias option when launching Tiled2Unity (the quick and dirty way to "fix" seams) then you'll want to turn that off.

BTW, if this is the scene view then there's probably always going to be little artifacts like this. But if you're getting these results in the game view then that's another story.

zane49er2 commented 6 years ago

I'm using a unity store asset that is setting my camera size to a multiple of my pixel size, and the rest of the tiles are working perfectly with it. Also, these artefacts are appearing in the mesh and the prefab, their thumbnails, and in both views. Tiled2Unity seems to actually be exporting those tiles as scaled. I'm going to try re-making the map with a new version of the spritesheet, and get back to you on whether that fixes it or not.

zane49er2 commented 6 years ago

The new tileset didn't help: https://snag.gy/Q6Aikt.jpg

Seanba commented 6 years ago

Hmmm ... but that last screenshot looks like you're getting seams though. If I'm seeing it correctly, it looks like you're getting a whole column of pixels from a nearby tile on your tilesheet.

FWIW, Tiled2Unity doesn't perform any non-uniform scaling on any vertices or texture coordinates.

If you want to export your game into a Unity Package I can investigate it further. (You can find my email on my website: www.seanba.com)

zane49er2 commented 6 years ago

https://snag.gy/Sv2dtk.jpg It happens on all tiles which are not adjacent to another of the same tile.

zane49er2 commented 6 years ago

I was wrong. https://snag.gy/7NIGRS.jpg