diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index b18369dd11f..7c43368f961 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -905,11 +905,16 @@ void SceneTree::_process_group(ProcessGroup *p_group, bool p_physics) { return; } - bool &node_order_dirty = p_physics ? p_group->physics_node_order_dirty : p_group->node_order_dirty; - - if (node_order_dirty) { - nodes.sort_custom(); - node_order_dirty = false; + if (p_physics) { + if (p_group->physics_node_order_dirty) { + nodes.sort_custom(); + p_group->physics_node_order_dirty = false; + } + } else { + if (p_group->node_order_dirty) { + nodes.sort_custom(); + p_group->node_order_dirty = false; + } } // Make a copy, so if nodes are added/removed from process, this does not break