From 0823ae7ae47989c31d64de222d6f6e4bdcea1962 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: 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. --- 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 368dea7649..2f23c11748 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2077,7 +2077,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) -- cgit v1.2.3