Quick answer: Add a Physics Layer to the TileSet, then edit each tile and draw a physics shape on that layer. TileMap collision only works if both Physics Layer definition AND per-tile polygons exist. Character’s collision_mask must include the layer.
Here is how to fix Godot TileMap collision layer not working. You paint walls on your tilemap. You run the scene. Player walks through them. You check the player’s collision_mask — layer 1 is ticked. You check the TileMap’s collision_layer — also layer 1. Nothing wrong on the surface. But the TileSet (the resource painting the tiles) requires its own physics setup that is not inherited from the TileMap node.
The Symptom
CharacterBody2D or RigidBody2D passes through tiles that should be solid. Navigation agents compute paths through walls. TileMap.collision_layer is set but collisions do not register. Tiles render correctly (not a visual issue).
What Causes This
TileSet missing Physics Layer. Collision on a TileMap is defined in two places: the TileSet (which tiles have collision shapes on which layer) and the TileMap (which layers those shapes live in). If the TileSet has no Physics Layer defined, no tile has collision regardless of TileMap settings.
Tiles missing physics shapes. Even with Physics Layer 0 defined on the TileSet, each individual tile must have a collision polygon drawn for that layer. Tiles painted from an atlas without physics shapes produce tiles with no collision.
Character’s mask not matching. Your player’s collision_mask must include the bit for the TileMap’s Physics Layer 0 collision layer value. Layer numbering is 1-indexed in editor, so Physics Layer 0 defaults to layer 1 (bit 1).
Godot 4 TileMap vs TileMapLayer. Godot 4.3 introduced TileMapLayer replacing the old layered TileMap. Each TileMapLayer is a separate node with its own collision_layer property. If you migrated, ensure the layer on each TileMapLayer is set correctly.
The Fix
Step 1: Add Physics Layer to TileSet. Open your TileSet resource (double-click the .tres). Switch to the TileSet tab. Under Physics Layers, click Add Element. Set its Collision Layer to 1 (or whatever layer you want).
Adding a Physics Layer doesn’t automatically add collision to tiles — you still need to draw physics shapes per tile.
Step 2: Draw collision polygons per tile. Switch to the Atlas tab. Select the tile. In the Inspector, scroll to Physics. Click the Physics Layer 0 property. In the shape editor, draw a polygon that covers the tile’s collision area (usually a square matching tile bounds).
For bulk: select multiple tiles at once and “Paint Properties” on the collision shape. All selected tiles get the same shape.
Step 3: Verify collision_layer on TileMap. Select the TileMap (or TileMapLayer) node. In the Inspector, Physics section. Collision Layer should include the layer you want tiles to occupy. Default is layer 1.
Step 4: Check character’s mask. Select CharacterBody2D or RigidBody2D. Physics section. Collision Mask should include layer 1 (or whatever layer the TileMap uses).
extends CharacterBody2D
func _ready():
# Programmatic collision mask check
print("My collision_mask: ", collision_mask)
for node in get_tree().get_nodes_in_group("tilemap"):
print("Tilemap collision_layer: ", node.collision_layer)
Masks are bitfields: layer 1 = 1, layer 2 = 2, layer 3 = 4, layer 4 = 8. Typical player: collision_mask = 1 (hits layer 1 only).
Debugging Collision Shapes
Enable Debug > Visible Collision Shapes in the running game. The viewport draws all collision shapes in cyan. Tiles without shapes render no cyan outline. Select the TileMap node in the Scene dock to see its aggregated shapes.
If you see outlines on other objects (player, walls) but not tiles, the TileSet physics layers are missing. If you see tile outlines but collision still fails, the mask/layer mismatch is the issue.
One-Way Collision
For platformer one-way platforms (jump up through, land on top), in the tile’s physics polygon editor enable “One Way”. The collision only activates when the body approaches from above.
“TileMap collision is TileSet + TileMap + character. Setup all three sides or painful invisibility ensues.”
Related Issues
For Area2D detection issues, see Area2D Not Detecting StaticBody2D. For CharacterBody2D issues, CharacterBody2D Floor Snap.
Physics Layer on TileSet. Shape per tile. Mask on character. All three, every time.