Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix massive CPU leak in NavigationAgent2D/3D after unpausing

mxtherfxcker7fa8a11676c8
diff --git a/modules/navigation_2d/nav_agent_2d.cpp b/modules/navigation_2d/nav_agent_2d.cpp
index a1bfa878e1b..5c55b31b71c 100644
--- a/modules/navigation_2d/nav_agent_2d.cpp
+++ b/modules/navigation_2d/nav_agent_2d.cpp
@@ -284,7 +284,7 @@ void NavAgent2D::set_paused(bool p_paused) {
if (map) {
if (paused) {
map->remove_agent_as_controlled(this);
- } else {
+ } else if (avoidance_enabled) {
map->set_agent_as_controlled(this);
}
}
diff --git a/modules/navigation_3d/nav_agent_3d.cpp b/modules/navigation_3d/nav_agent_3d.cpp
index 8e30fa0d8b9..4c882085c01 100644
--- a/modules/navigation_3d/nav_agent_3d.cpp
+++ b/modules/navigation_3d/nav_agent_3d.cpp
@@ -394,7 +394,7 @@ void NavAgent3D::set_paused(bool p_paused) {
if (map) {
if (paused) {
map->remove_agent_as_controlled(this);
- } else {
+ } else if (avoidance_enabled) {
map->set_agent_as_controlled(this);
}
}