I’m having issues with the sorting of certain tall objects. No matter what I do either the sorting doesn’t work correctly or the sprite itself has an offset. (I already have the Y sorting enabled.)
For example this lamp has an intentional gap at the bottom so it’s aligned in a certain way along the grid.
However the gap messes with the sorting because the bottom of the canvas is used as the pivot point.
I found that if I modify the Image Rect in the object property it fixes the sorting. The sprites appear correctly in Tiled. But when the map is imported in unity with SuperTiled2Unity, the entire sprite appears offset.
Anyone has any insight on how to fix this issue?
Possible solutions I already thought of (all less than ideal)
I guess I could crop the sprites but then I would have to manually place each sprite without being able to snap it to the grid. (If I used it then the sprites would appear offset)
Another way would be to use unity gameobjects, but then it would break my workflow since I would only be able to make 50% of the map in Tiled.
Offsetting the layer would mean a different layer for each type of prop. That would be too many layers.
There’s no pivot point in Tiled, but you may be able to set one in Unity. If ST2U doesn’t support anything for that, you can probably use prefab replacement - it’s more upfront set-up since you have to make Unity prefabs for every affected Tile Object, but after that it would be automatic.
Whether you use the image rect or the crop, positioning the sprites has the same issue with snapping. So, if ST2U doesn’t support image rects, you can crop.
There is an issue open to allow per-tile drawing offsets which would help with the snapping problem and it’s being worked on, but you would still need to wait for ST2U to support this feature after it’s added.
For now, you can use Tiled scripting to “snap” objects after they have been placed (e.g. on save; there’s currently no way to run a script when an object is placed), or you can write a custom tool that snaps things based on pivot set in a custom property on the tile.
The fact that Tiled treats the image as the end-all, be-all of Tile Objects, when sprite objects in games are usually sprites on top of a shape drawn at some offset, is the real problem here. If Tiled treated them more like engines treat them, snapping would have nothing to do with the sprite’s size and shape, and positioning the sprite on the object would be decoupled from positioning it in a tile layer. I’ve complained about the way Tile Objects work on Tiled’s GitHub before, but I think it might be time to open a dedicated issue for it.
I was going to open a more complex one about attaching sprites to shape Objects, but I think a per-object origin point (for both Tile and non-Tile objects) would solve the important problems just as well :D