aboutsummaryrefslogtreecommitdiff
path: root/scene/main/node.cpp
diff options
context:
space:
mode:
authorLink2018-03-07 08:21:46 +0800
committerLink Doyle2018-03-07 18:28:29 +0800
commit611c05046948693a7b23ca697f73b9217f1a7c6f (patch)
treed4e7492d311da166f77985b182039e80a082bc9c /scene/main/node.cpp
parent2f3c45f55eab7364ff0f6806c81ddc7ba861e1a2 (diff)
downloadgodot-611c05046948693a7b23ca697f73b9217f1a7c6f.tar.gz
godot-611c05046948693a7b23ca697f73b9217f1a7c6f.tar.zst
godot-611c05046948693a7b23ca697f73b9217f1a7c6f.zip
Diffstat (limited to 'scene/main/node.cpp')
-rw-r--r--scene/main/node.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index cf22383e3..28b454057 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2502,7 +2502,10 @@ void Node::replace_by(Node *p_node, bool p_keep_data) {
Node *child = get_child(0);
remove_child(child);
- p_node->add_child(child);
+ if (!child->is_owned_by_parent()) {
+ // add the custom children to the p_node
+ p_node->add_child(child);
+ }
}
p_node->set_owner(owner);