How to get world position of tile in tilemap ?

I’m working on my tilemap-based game and I need to get positions of the tiles in a tilemap. I set up like this. The grid’s cell size is 0.16 since the sprites of each tile is 16x16 px:
alt text

In TilemapController2, I loop through tilemap’s size and use CellToWorld to get position, but it doesn’t seems to be correct. As in the screenshot, the center of the tilemap is on the left of the point (0, 0), but the iterator gives me position of tile (0, 0) is exactly (0, 0), which is incorrect because the bottom-left tile of the tilemap is far from point (0, 0). This is the content of TilemapController2:

public class TilemapController2 : MonoBehaviour {
	public Tilemap Tilemap;

	// Use this for initialization
	void Start () {
		Vector3 tilePosition;
		Vector3Int coordinate = new Vector3Int(0, 0, 0);
		for (int i = 0; i < Tilemap.size.x; i++) {
			for (int j = 0; j < Tilemap.size.y; j++) {
				coordinate.x = i; coordinate.y = j;
				tilePosition = Tilemap.CellToWorld(coordinate);
				Debug.Log(string.Format("Position of tile [{0}, {1}] = ({2}, {3})", coordinate.x, coordinate.y, tilePosition.x, tilePosition.y));
			}
		}
	}
}

I’ve tried several other methods, but none of them give me the correct world position of the tile.

Have you tried void GetTileData() ? It needs to be in the script of the tile, so you may have to make a new one. But it works!

I’ve found the way to get tiles positions here: https://forum.unity.com/threads/tilemap-tile-positions-assistance.485867/

you can go to
this link

it takes you to the unity documentation regarding getting the position of a particular tile in world coordinates
hope this helps you and everyone following this question
:slight_smile: