diff --git a/scene/2d/area_2d.cpp b/scene/2d/area_2d.cpp index ae5891fa50d..4a4aaf3238d 100644 --- a/scene/2d/area_2d.cpp +++ b/scene/2d/area_2d.cpp @@ -158,7 +158,9 @@ void Area2D::_body_inout(int p_status, const RID &p_body, int p_instance, int p_ Map::Element *E = body_map.find(objid); - ERR_FAIL_COND(!body_in && !E); + if (!body_in && !E) { + return; //does not exist because it was likely removed from the tree + } locked = true; diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp index 5e78368804d..ac77ddb7ce6 100644 --- a/scene/3d/area.cpp +++ b/scene/3d/area.cpp @@ -157,7 +157,9 @@ void Area::_body_inout(int p_status, const RID &p_body, int p_instance, int p_bo Map::Element *E = body_map.find(objid); - ERR_FAIL_COND(!body_in && !E); + if (!body_in && !E) { + return; //likely removed from the tree + } locked = true;