- Home /
Tilemap.hastile always returns false
Debug.Log(floor.HasTile(new Vector3Int(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y), 0)));
This always returns false for some reason. Floor is set correctly and there are floor tiles everywhere, but no matter where I move the character, it's always false. Am I missing something here?
Comment
Answer by Mouton_redstone · May 29 at 02:37 PM
instead of rounding up you coordinates use tilemap.WorldToCell(Vector3 position) it will return a Vector3Int of the cell position you are in depending of the world coordinates