Instantiate global classes properly, fixes #20857
This commit is contained in:
parent
d0f289b0d9
commit
98ffb6b37e
1 changed files with 13 additions and 1 deletions
|
@ -2187,7 +2187,19 @@ void EditorPropertyResource::_menu_option(int p_which) {
|
|||
return;
|
||||
}
|
||||
|
||||
Object *obj = ClassDB::instance(intype);
|
||||
Object *obj = NULL;
|
||||
|
||||
if (ScriptServer::is_global_class(intype)) {
|
||||
obj = ClassDB::instance(ScriptServer::get_global_class_base(intype));
|
||||
if (obj) {
|
||||
Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(intype));
|
||||
if (script.is_valid()) {
|
||||
obj->set_script(Variant(script));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
obj = ClassDB::instance(intype);
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource");
|
||||
|
|
Loading…
Reference in a new issue