- Home /
paint tilemap through code
Hello there
I want to make a game where the player moves through a tilemap and paints it a solid color as they go. How can I do it?
Comment
Answer by Mouton_redstone · May 29 at 02:32 PM
just make a tilemap full of that color and use this code
public Tilemap tilemap; //set you player's tilemap here
public Transform player; //put your player gameObject here
void Update() {
Vector3Int playerPosition = tilemap.WorldToCell(player.position);
tilemap.SetTile(playerPosition, null);
}