SuperTiled2Unity
SuperTiled2Unity copied to clipboard
Game Objects are being placed in wrong positions.
I have a map with Objects, some of which are undergoing prefab replacement. Bot the non-replace and replaced objects are not being placed in alignment with the tiles. The replaced objects are all being shifted by (0.16, 0.48) (32 ppu). The non-replaced objects are being shift by about (0, 0.36).
The prefabs being added to the scene via replace have coordinates (0,0,0) so I don't think their offsets are stemming from a prefab setting. All of the coordinates in Unity seem to translate to the coordinates in tiled, so I think it has to do with my Unity settings.


I know it's old, but: Tiled use as Pivot the LeftBottom. If u use in SpriteRender images with bottomLeft pivot works. But if u have set different pivot, or custom one...byebye. I've create a script with private bool moveCenterToPivot = false;
public bool MoveCenterToPivot
{ get => moveCenterToPivot;
set
{
moveCenterToPivot = value;
if (value)
{
SpriteRenderer spriteRenderer = GetComponentInChildren<SpriteRenderer>();
Vector3 pivotInUnits = spriteRenderer.sprite.pivot / spriteRenderer.sprite.pixelsPerUnit;
this.gameObject.transform.position = this.gameObject.transform.position + pivotInUnits;
}
}
}
and i add to every Object. In tiled I put a boolean MoveCenterToPivot (true) for every object that need to move.