summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_cache.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-22 08:31:24 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-22 08:31:24 +0100
commit17b0c862ff0e2b8e48429b89750872790584e4ea (patch)
tree79ed42229732731764ed62f3a05be680df65a52c /modules/gdscript/gdscript_cache.cpp
parente7418cac3d5095d981272f07ae79a756863a5678 (diff)
parente86e15571f12cb4a0bcb699f112c0821f11a8a57 (diff)
Merge pull request #68972 from adamscott/fix-godot#68971-cached-scene
Fetch cached scene if it exists in `GDScriptCache::get_packed_scene()`
Diffstat (limited to 'modules/gdscript/gdscript_cache.cpp')
-rw-r--r--modules/gdscript/gdscript_cache.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_cache.cpp b/modules/gdscript/gdscript_cache.cpp
index add36591f3..2e7263b652 100644
--- a/modules/gdscript/gdscript_cache.cpp
+++ b/modules/gdscript/gdscript_cache.cpp
@@ -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;