Explorar o código

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 %!s(int64=3) %!d(string=hai) anos
pai
achega
4035a4103c
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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) {