diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-22 08:31:24 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-22 08:31:24 +0100 |
commit | 17b0c862ff0e2b8e48429b89750872790584e4ea (patch) | |
tree | 79ed42229732731764ed62f3a05be680df65a52c /modules/gdscript/gdscript_cache.cpp | |
parent | e7418cac3d5095d981272f07ae79a756863a5678 (diff) | |
parent | e86e15571f12cb4a0bcb699f112c0821f11a8a57 (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.cpp | 7 |
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; |