Merge pull request #70277 from rune-scape/picker-regression

Fix resource picker regression
This commit is contained in:
Rémi Verschelde 2022-12-23 09:20:57 +01:00
commit b31bf1f823
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 3 additions and 2 deletions

View File

@ -947,9 +947,10 @@ Variant EditorData::script_class_instance(const String &p_class) {
if (ScriptServer::is_global_class(p_class)) {
Ref<Script> script = script_class_load_script(p_class);
if (script.is_valid()) {
Object *obj = ClassDB::instantiate(script->get_instance_base_type());
// Store in a variant to initialize the refcount if needed.
Variant obj = ClassDB::instantiate(script->get_instance_base_type());
if (obj) {
obj->set_script(script);
obj.operator Object *()->set_script(script);
}
return obj;
}