From a2297c64e66d51afddd6829a585d89b21a846408 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 29 Jul 2018 17:39:06 -0300 Subject: [PATCH] Perform a name check when loading scenes and running on editor, fixes #6152 (cherry picked from commit 200c6cf630aa56b98310b3e747439795f8abbab8) --- scene/resources/packed_scene.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index f18535541a8..4d19e4727b9 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -31,6 +31,7 @@ #include "packed_scene.h" #include "core/core_string_names.h" +#include "engine.h" #include "io/resource_loader.h" #include "project_settings.h" #include "scene/2d/node_2d.h" @@ -277,7 +278,12 @@ Node *SceneState::instance(GenEditState p_edit_state) const { stray_instances.push_back(node); //can't be added, go to stray list } } else { - node->_set_name_nocheck(snames[n.name]); + if (Engine::get_singleton()->is_editor_hint()) { + //validate name if using editor, to avoid broken + node->set_name(snames[n.name]); + } else { + node->_set_name_nocheck(snames[n.name]); + } } }