From 97feafd0ea67580c91c699ed58d771cc80842e32 Mon Sep 17 00:00:00 2001 From: reduz Date: Sat, 12 Feb 2022 10:57:51 +0100 Subject: [PATCH] Fix resource reuse in binary loader * Reuse was not setting the internal index. * Supersedes #52599, without re-reading all properties. --- core/io/resource_format_binary.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 8588bab0be8..ed58b4be7ba 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -678,11 +678,13 @@ Error ResourceLoaderBinary::load() { internal_resources.write[i].path = path; // Update path. } - if (cache_mode == ResourceFormatLoader::CACHE_MODE_REUSE) { - if (ResourceCache::has(path)) { + if (cache_mode == ResourceFormatLoader::CACHE_MODE_REUSE && ResourceCache::has(path)) { + RES cached = ResourceCache::get(path); + if (cached.is_valid()) { //already loaded, don't do anything stage++; error = OK; + internal_index_cache[path] = cached; continue; } }