Quick answer: Open the NavigationPolygon resource on the region. Set Parse Geometry → Source Group, then add your wall nodes to that group. Bake. The bake now sees walls regardless of where they live in the tree.
You bake a NavigationRegion2D and half your dungeon’s walls are ignored. Agents walk diagonally through stone. The bake source isn’t finding the wall colliders because they’re not where the parser is looking.
The Symptom
Bake produces a navmesh that ignores some walls (often TileMap-based ones). Or the navmesh covers regions that should be impassable. Agents path through walls.
The Mental Model
NavigationRegion2D bakes a NavigationPolygon resource. The polygon’s Geometry section configures:
- Parsed Geometry Type — Mesh Instances, Static Colliders, or Both.
- Source Geometry Mode — Root Node Children, Group With Children, or Group Explicit.
- Source Group Name — for Group modes, the group whose nodes contribute geometry.
Default Source Geometry Mode = Root Node Children only finds direct children of the NavigationRegion2D. If your walls are nested elsewhere, they’re invisible to the bake.
The Fix
Step 1: Set Source Geometry Mode = Group With Children. Open the NavigationPolygon. Geometry → Source Geometry Mode → Group With Children. Name the group “navmesh_source.”
Step 2: Add wall nodes to the group. Select your wall TileMap or StaticBody2D. Inspector → Node tab → Groups → Add “navmesh_source.”
Step 3: Set Parsed Geometry Type to Both. Some walls are colliders, some are mesh outlines. Both Types covers all bases.
Step 4: Bake. Click NavigationRegion2D in scene tree. Click the “Bake NavigationPolygon” button in the inspector preview. The polygon updates to enclose the walkable area, with walls excluded.
Runtime Bake
extends NavigationRegion2D
func rebake_for_destruction(broken_wall: Node2D) -> void:
broken_wall.queue_free()
await get_tree().process_frame
bake_navigation_polygon(true) # async
For dynamically changing levels, rebake after the change. Async bake doesn’t block the main thread.
NavigationObstacle2D for Dynamic Carve
For obstacles that move at runtime (a moving block, a temporarily-locked door), use NavigationObstacle2D instead of rebaking. The obstacle creates a runtime hole in the navmesh that agents avoid without re-baking.
Verifying
Project Settings → Debug → Settings → Visible Navigation. Reload the scene. The navmesh renders as a colored polygon. Walk the camera; navmesh should follow walkable area, miss walls. If walls appear inside, the source group doesn’t include them.
“Group source. Both types. Bake. Walls become walls.”
Related Issues
For NavigationAgent2D not pathing, see agent not pathing. For dynamic obstacle, see obstacle blocking.
Source group. Bake. The pathfinding sees the level.