diff options
author | smix8 <52464204+smix8@users.noreply.github.com> | 2024-07-14 21:53:14 +0200 |
---|---|---|
committer | smix8 <52464204+smix8@users.noreply.github.com> | 2024-07-14 22:01:11 +0200 |
commit | 9dd05964d587b35db84497ed9cfda0dd1d012fe4 (patch) | |
tree | 5d8fcf999b169b9a3098acda57ab230116903710 | |
parent | 97b8ad1af0f2b4a216f6f1263bef4fbc69e56c7b (diff) | |
download | redot-engine-9dd05964d587b35db84497ed9cfda0dd1d012fe4.tar.gz |
Fix NavigationPolygon not updating consistently on rebakes
Fixes that NavigationPolygon did not update in all cases because the internal NavigationMesh was not always unref and freed which blocked creating a new mesh later if nothing else freed it.
-rw-r--r-- | scene/resources/2d/navigation_polygon.cpp | 4 |
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) { |