Reputation: 37
I am trying to delete a tile whenever my player is colliding with it. I can delete the tile with mouseclick by this script
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Vector3Int position = dirtGrid.WorldToCell(mousePos);
dirtTilemap.SetTile(position, null);
However i want the players collider to collide with the tile and then get that tiles position to delete the tile :)
If anyone has any idea please feel free to tell me!
Upvotes: 0
Views: 1386
Reputation: 117
I don't have enough reputation to leave a comment, so I'll have to direct you to this other question with an answer. I've tried to work with individual tile collisions before as well and found this.
Upvotes: 2