Merge pull request #21614 from willnationsdev/instance-with-name

Fix script classes not instancing with custom name.
This commit is contained in:
Rémi Verschelde 2018-08-31 08:24:20 +02:00 committed by GitHub
commit fc01c79356
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 {