SuperTiled2Unity
SuperTiled2Unity copied to clipboard
The grid is not aligned after being imported into unity
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"); }