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: [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. --- 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 368dea76498..2f23c117481 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)