Browse Source

Fix resource reuse in binary loader

* Reuse was not setting the internal index.
* Supersedes #52599, without re-reading all properties.
reduz 3 years ago
parent
commit
97feafd0ea
1 changed files with 4 additions and 2 deletions
  1. 4 2
      core/io/resource_format_binary.cpp

+ 4 - 2
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;
 				}
 			}