summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-17 11:44:09 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-17 11:44:09 +0200
commitc77c41df88a1076e85ae0b92baf6aa25c5002cb5 (patch)
treed8a69a5ea813d4a0ee37d092be241464453a6b40
parent44cb48eaae60f0ff75add735c06237a3534d6e30 (diff)
parent9dd05964d587b35db84497ed9cfda0dd1d012fe4 (diff)
downloadredot-engine-c77c41df88a1076e85ae0b92baf6aa25c5002cb5.tar.gz
Merge pull request #94362 from smix8/navpoly_unref_fix
Fix NavigationPolygon not updating consistently on rebakes
-rw-r--r--scene/resources/2d/navigation_polygon.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/scene/resources/2d/navigation_polygon.cpp b/scene/resources/2d/navigation_polygon.cpp
index a845809bf2..4a290db86b 100644
--- a/scene/resources/2d/navigation_polygon.cpp
+++ b/scene/resources/2d/navigation_polygon.cpp
@@ -193,6 +193,10 @@ void NavigationPolygon::set_data(const Vector<Vector2> &p_vertices, const Vector
for (int i = 0; i < p_polygons.size(); i++) {
polygons.write[i].indices = p_polygons[i];
}
+ {
+ MutexLock lock(navigation_mesh_generation);
+ navigation_mesh.unref();
+ }
}
void NavigationPolygon::get_data(Vector<Vector2> &r_vertices, Vector<Vector<int>> &r_polygons) {