summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-31 08:24:20 +0200
committerGitHub <noreply@github.com>2018-08-31 08:24:20 +0200
commitfc01c793567c84007783c539dd67ed27e83242bb (patch)
tree050689205b84cae2db6235c96b6007ebe612fe37 /editor
parentf2e52ff915e150e8713b5ff5e7a06c3092e9a04c (diff)
parentdee0ee749d8211d862d73a005af3e4ab39e63892 (diff)
Merge pull request #21614 from willnationsdev/instance-with-name
Fix script classes not instancing with custom name.
Diffstat (limited to 'editor')
-rw-r--r--editor/create_dialog.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 8433f4ff7b..fd607e5b63 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<Node>(obj);
+ if (n)
+ n->set_name(custom);
+ return obj;
}
return EditorNode::get_editor_data().instance_custom_type(selected->get_text(0), custom);
} else {