SuperTiled2Unity icon indicating copy to clipboard operation
SuperTiled2Unity copied to clipboard

The grid is not aligned after being imported into unity

Open 173198205 opened this issue 1 year ago • 3 comments

One feature I want to implement is that when you click on a tile, you can know which tile you clicked on and show a selected status in the center of that tile. But I found that the grid is not aligned with unity's tilemap grid, causing a misalignment. What should I do? My test code:

if (Input.GetMouseButtonDown(0)) { Vector2 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition); var cellPos = Tilemap.WorldToCell(pos); var tile = Tilemap.GetTile(cellPos); if (tile != null) { var wPos = Tilemap.CellToWorld(cellPos); select.gameObject.transform.position = wPos; Debug.Log($"click tile:{tile.name}-{cellPos}"); } Debug.Log("GetMouseButtonDown"); }

Snipaste_2024-05-13_18-12-23 Snipaste_2024-05-13_18-11-27 Snipaste_2024-05-13_18-12-51 Snipaste_2024-05-13_18-13-25

173198205 avatar May 13 '24 10:05 173198205