Seanba / SuperTiled2Unity

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

Isometric tilemap has inverted sorting order when imported into unity #239

Open BossGrand opened 1 year ago

BossGrand commented 1 year ago

Hi I have a isometric tile map that looks like this in Tiled image

When I import it into unity I get the following result.

image

If I manually invert all the sorting orders of the tiles generated by SuperTiled I get the expected layout. I have a script that negates each sorting order of the tiles, effectively reversing the sorting order image

I couldn't find any setting or docs on how to fix this. Am I doing something wrong or is this a bug?

seanb-22ct commented 1 year ago

Hi there, @BossGrand. That looks like a bug. Can you share your project with me so I can take a closer look?

seanb-22ct commented 1 year ago

Hi again. It just occurred to me that you may need a custom Transparency Sort Axis in your graphics settings.

Here's some Unity documentation on it: https://docs.unity3d.com/Manual/Tilemap-Isometric-CreateIso.html

BossGrand commented 1 year ago

I tried different transparency sort axises but none worked. Here is a demo repo of my project https://github.com/BossGrand/Iso-Demo

seanb-22ct commented 1 year ago

Hi again, @BossGrand. I had forgotten that Isometric maps, by necessity, are rendered as objects and not as tiles in a tilemap. This is because Unity does not support the concept of an Isometric map. (Staggered Isometric maps are supported though.)

In order to have the isometric objects rendered in the proper order you'll need reimport your Tiled maps with either the Overhead Static (probably best) or Overhead Dynamic layer/object sorting.

image

This should have been handled for you automatically but it is a bug I need to fix. In the meantime I hope that setting helps you out.

FWIW, depending on your game you may want to just go with the staggered isometric map option in Tiled.

BossGrand commented 1 year ago

Were you able to get it to work properly? I tried both overhead static/dynamic and neither seemed to have an effect. I pressed apply, deleted the grid from the game and then re placed it from the assets

As for the isometric, I want to make a Tactics game like Tactics Ogre :) so the current layout is what I need

BossGrand commented 1 year ago

image

seanb-22ct commented 1 year ago

Hi again, @BossGrand. Yes, I got it working. Keep in mind that you still have to use a custom sort axis.

image

BossGrand commented 1 year ago

Oh awesome I didn't have them both set, thank you so much!

seanb-22ct commented 1 year ago

I'm glad you got it working. I'm going to keep this issue open for now because there are a couple of small items I want to clean up on my end. I don't want the user to be confused like this when things are looking right. :)