How to show the debug view of a navemesh created by code with NavigationServer2D?

Godot Version

4.5 dev5

Question

In the running project picture below, I have 2 navigation regions, the one on left is created in editor, it shows up when the visible navigation is checked.

In the red rect on the right, there is actually another navigation region that I created during runtime, it’s working but it’s debug view is not show up like the one on the left, what should I do to make it visible?

Thanks!

The debug is rendered by the nodes, so you need to set your navmesh resource (again) on a NavigationRegion2D node in order to trigger a debug rendering or an update to it. When you change the navmesh resource directly in code the node is not aware of any of those changes.

1 Like

Right! that makes sense, thanks!