Trying to make tilemap disappear

Godot 4.2.1

I’m trying to make a tilemap disappear without destroying it. I tried to use: $TileMap.hide(). However, this did not deactivate the tilemap’s collision. I also tried to do $TileMap.layer_0.enabled = false and just $TileMap.enabled = false, but these also didn’t work. I couldn’t find a solution on the internet, so if someone could help me I’d be thankful.

For the collision, turn off the tilemap’s collision mask. That should solve it.

How do I do this via script? I tried using $TileMap.set_collision_mask_bit(1, false) but it didn’t work out, it says it’s not a function

That’s because it isn’t. You can’t just dream up function names and expect it to work somehow! Anyway, here’s how to actually change the mask from code:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.