SuperTiled2Unity Version 1.8.1


Version 1.8.1 Changelog

Added

  •  Can now set local z-position of an imported Tiled layer by using a unity:z-pos custom property
  •  Can now re-import Tiled assets using the default ST2U settings. This is useful if you want to change the `Pixels Per Unit` setting of all imported maps and tilesets, for instance.

Fixed

  • Layer offset position fixed when using grouping

Changed

  • TMX import version increased to 19 (forces re-import of all TMX files)

Files

SuperTiled2Unity.1.8.1.unitypackage 416 kB
Nov 13, 2019

Get Super Tiled2Unity

Download NowName your own price

Comments

Log in with itch.io to leave a comment.

(2 edits)

I just updated to 1.8.1 (from 1.6.2) and all my tiles just shifted one position down :| visually at least.

I position an object(the yellow one) by dragging and dropping it onto tile positions by using the following method.

I get a position of the the tile where my object was dropped (where the mouse is) by using the following.

var pos = CurrentTilemap.WorldToCell(Camera.allCameras[0].ScreenToWorldPoint(Input.mousePosition));

And use CellToWorld to get the position of the tile. I also use it to get and identify the tile as well (CurrentTilemap.GetTile(pos)).

var p = CurrentTilemap.CellToWorld(pos);

I then position my dropped object by using this, so that it sits exactly on top of it and not on the edge (0,0) of the tile.

p.x += CurrentTilemap.cellSize.x / 2;
p.y += CurrentTilemap.cellSize.y / 2;


Right now, all my tiles seems to have shifted down visually, but the tile position remains the same; and CurrentTilemap.HasTile(pos) returns true when technically there is no visible tile there. I can open an issue on github if it helps; I'm unsure why this is happening. Any help would be awesome! Thank you.

ps: for the time being, I reverted back to 1.6.2 and re-imported all the tiles and it works fine :|

(1 edit)

Hi there, Yadu. Version 1.8.1 fixes bugs related to sorting and positioning for the different tile types. It's a long story of the differences between tile placement in Tiled vs. Unity and the coordinate systems they use but, yes, I can how this is causing an issue for you.

I think the best option for you would be to have your own CellToWorld function that modifies pos.y (decrements by one) or change your placement code to subtract an additional cellSize.y from p.y. 

If you want to discuss this more then open a bug on github and we can see if there's better options.

I can probably try that and see how it goes, but I feel this happens during import somewhere. On 1.6.2 this is how an imported level looks (notice the bounding box) for the selected layer(bg).


And I just updated to 1.8.1 and re-imported the tmx files and this is the exact same level and here that bounding box has shifted up by one row.

I've added an issue on github - https://github.com/Seanba/SuperTiled2Unity/issues/110