Merge pull request #68972 from adamscott/fix-godot#68971-cached-scene

Fetch cached scene if it exists in `GDScriptCache::get_packed_scene()`
This commit is contained in:
Rémi Verschelde 2022-11-22 08:31:24 +01:00
commit 17b0c862ff
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -342,7 +342,12 @@ Ref<PackedScene> GDScriptCache::get_packed_scene(const String &p_path, Error &r_
return singleton->packed_scene_cache[p_path];
}
Ref<PackedScene> scene;
Ref<PackedScene> scene = ResourceCache::get_ref(p_path);
if (scene.is_valid()) {
singleton->packed_scene_cache[p_path] = scene;
singleton->packed_scene_dependencies[p_path].insert(p_owner);
return scene;
}
scene.instantiate();
r_error = OK;