Closed Malcolmnixon closed 11 months ago
Inspecting NavigationRegion3D::set_enabled()
shows that it implements enabling and disabling of regions via NavigationServer3D::get_singleton()->region_set_enabled(region, enabled);
.
As such I suspect NavigationRegion3D::_region_enter_navigation_map()
should always register the region with the map using the NavigationServer3D::get_singleton()->region_set_map(region, xxx);
, but should follow it up with a NavigationServer3D::get_singleton()->region_set_enabled(region, enabled);
call.
Godot version
4.2-beta.1
System information
Windows 11, Vulkan Mobile, NVidia RTX 3070 TI
Issue description
I have numerous "bridges" (meshes with NavigationRegion3D) that start life disabled (NavigationRegion3D.enabled = false).
In Godot 4.1 I could enable these bridges in script when the player triggered an action, and the NavigationRegion3D would correctly enable with edge connections allowing NPCs to walk across the bridge.
In Godot 4.2 if the NavigationRegion3D is saved disabled then enabling/disabling fails to enable edge connections. I suspect the bug may have been introduced by https://github.com/godotengine/godot/pull/77191 in
NavigationRegion3D::_region_enter_navigation_map
. This function only registers the region with the world-map if the region is enabled when it enters the tree. Enabling at a later time does not register the region.Steps to reproduce
Attached is a simple demo project. When loaded the main scene shows the following three navigation regions and their edge connections:
Toggling the enable on region 1 works as expected:
Save the scene with region 1 disabled; then close and reopen it:
Toggling the enable on region 1 fails to enable the edge connections:
Minimal reproduction project
NavRegionDisabledBug.zip