diff options
author | Adam Scott <ascott.ca@gmail.com> | 2022-11-21 15:57:45 -0500 |
---|---|---|
committer | Adam Scott <ascott.ca@gmail.com> | 2022-11-21 15:57:45 -0500 |
commit | e86e15571f12cb4a0bcb699f112c0821f11a8a57 (patch) | |
tree | a70b344abbde2547a8675da7b816ff0a6d908850 /modules/gdscript | |
parent | 11e1c83309e7e7c15018c8b2c6456fa294116244 (diff) |
[godot#68971] Fetch cached scene if it exists in `GDScriptCache`
Diffstat (limited to 'modules/gdscript')
-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; |