From e86e15571f12cb4a0bcb699f112c0821f11a8a57 Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Mon, 21 Nov 2022 15:57:45 -0500 Subject: [godot#68971] Fetch cached scene if it exists in `GDScriptCache` --- modules/gdscript/gdscript_cache.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 GDScriptCache::get_packed_scene(const String &p_path, Error &r_ return singleton->packed_scene_cache[p_path]; } - Ref scene; + Ref 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; -- cgit v1.2.3