Update NavigationRegion2D when polygons of NavigationPolygon change

Updates NavigationRegion2D  when the NavigationPolygon emits its 'changed' signal due to e.g. polygons altered by script.
This commit is contained in:
smix8 2022-05-18 13:36:18 +02:00
parent 7ea8cde983
commit 4035a4103c

View file

@ -509,6 +509,9 @@ void NavigationRegion2D::_navpoly_changed() {
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) {
update();
}
if (navpoly.is_valid()) {
NavigationServer2D::get_singleton()->region_set_navpoly(region, navpoly);
}
}
void NavigationRegion2D::_map_changed(RID p_map) {
if (enabled && get_world_2d()->get_navigation_map() == p_map) {