diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-08-31 08:24:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-31 08:24:20 +0200 |
commit | fc01c793567c84007783c539dd67ed27e83242bb (patch) | |
tree | 050689205b84cae2db6235c96b6007ebe612fe37 /editor | |
parent | f2e52ff915e150e8713b5ff5e7a06c3092e9a04c (diff) | |
parent | dee0ee749d8211d862d73a005af3e4ab39e63892 (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.cpp | 6 |
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 { |