Browse Source

Update NavigationRegion2D when polygons of NavigationPolygon change

Updates NavigationRegion2D  when the NavigationPolygon emits its 'changed' signal due to e.g. polygons altered by script.
smix8 3 years ago
parent
commit
4035a4103c
1 changed files with 3 additions and 0 deletions
  1. 3 0
      scene/2d/navigation_region_2d.cpp

+ 3 - 0
scene/2d/navigation_region_2d.cpp

@@ -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) {