From 9591e2950aaf20a36df670619757ffa49b0f8e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 28 May 2019 12:40:39 +0200 Subject: [PATCH] Node::duplicate: Don't set name if original node is nameless In practice this only happens when duplicating a node which is not in the scene tree yet, as nameless nodes get assigned a generated name when added to the scene tree. Fixes #27319. (cherry picked from commit 0823ae7ae47989c31d64de222d6f6e4bdcea1962) --- scene/main/node.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 93c5140a8cb..5ff22f27fb4 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2063,7 +2063,9 @@ Node *Node::_duplicate(int p_flags, Map *r_duplimap) const } } - node->set_name(get_name()); + if (get_name() != String()) { + node->set_name(get_name()); + } #ifdef TOOLS_ENABLED if ((p_flags & DUPLICATE_FROM_EDITOR) && r_duplimap)