From dee0ee749d8211d862d73a005af3e4ab39e63892 Mon Sep 17 00:00:00 2001 From: Will Nations Date: Thu, 30 Aug 2018 16:00:04 -0500 Subject: [PATCH] Fix Script Classes not instancing with custom name. --- editor/create_dialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 8433f4ff7bb..fd607e5b639 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -497,7 +497,11 @@ Object *CreateDialog::instance_selected() { if (custom != String()) { if (ScriptServer::is_global_class(custom)) { - return EditorNode::get_editor_data().script_class_instance(custom); + Object *obj = EditorNode::get_editor_data().script_class_instance(custom); + Node *n = Object::cast_to(obj); + if (n) + n->set_name(custom); + return obj; } return EditorNode::get_editor_data().instance_custom_type(selected->get_text(0), custom); } else {