Check that area is inside tree besides checking that queries are flushed, fixes #26148

This commit is contained in:
Juan Linietsky 2019-02-22 09:04:59 -03:00
parent 258bc03857
commit edbf1d0ea4
2 changed files with 2 additions and 2 deletions

View File

@ -426,7 +426,7 @@ bool Area2D::is_monitoring() const {
void Area2D::set_monitorable(bool p_enable) {
if (locked || Physics2DServer::get_singleton()->is_flushing_queries()) {
if (locked || (is_inside_tree() && Physics2DServer::get_singleton()->is_flushing_queries())) {
ERR_EXPLAIN("Function blocked during in/out signal. Use set_deferred(\"monitorable\",true/false)");
}
ERR_FAIL_COND(locked || Physics2DServer::get_singleton()->is_flushing_queries());

View File

@ -439,7 +439,7 @@ Array Area::get_overlapping_bodies() const {
void Area::set_monitorable(bool p_enable) {
if (locked || PhysicsServer::get_singleton()->is_flushing_queries()) {
if (locked || (is_inside_tree() && PhysicsServer::get_singleton()->is_flushing_queries())) {
ERR_EXPLAIN("Function blocked during in/out signal. Use set_deferred(\"monitorable\",true/false)");
}
ERR_FAIL_COND(locked || PhysicsServer::get_singleton()->is_flushing_queries());