diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 6e33dcb4c9e..f4fb48682c9 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2485,6 +2485,12 @@ void Node::replace_by(Node* p_node,bool p_keep_data) { rd.name=E->get().name; rd.value=get(rd.name); } + + List groups; + get_groups(&groups); + + for(List::Element *E=groups.front();E;E=E->next()) + p_node->add_to_group(E->get().name, E->get().persistent); } _replace_connections_target(p_node);