浏览代码

Update NavigationPolygonInstance when polygons of NavigationPolygon change

Updates NavigationPolygonInstance polygons on the NavigationServer2D when the NavigationPolygon Resource emits its changed signal due to e.g. polygons altered by script.
smix8 3 年之前
父节点
当前提交
37530b0871
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      scene/2d/navigation_polygon.cpp

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

@@ -498,6 +498,9 @@ void NavigationPolygonInstance::_navpoly_changed() {
 	if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())) {
 		update();
 	}
+	if (navpoly.is_valid()) {
+		Navigation2DServer::get_singleton()->region_set_navpoly(region, navpoly);
+	}
 }
 
 String NavigationPolygonInstance::get_configuration_warning() const {