Fix sub-resource storing the wrong index in cache
The subindex within Resource wasn't synchronized with the path stored in cache when saving a packed scene. It could cause sub-resources to be swapped when loading the same packed scene in the same session. Now the subindex in Resource reflects the sub-resource path in cache, making saving and loading sub-resources consistent. Co-authored-by: latorril <latorril@gmail.com>
This commit is contained in:
parent
0818a466c0
commit
3c3d7380e2
|
@ -575,6 +575,7 @@ Error ResourceLoaderText::load() {
|
|||
int_resources[id] = res; //always assign int resources
|
||||
if (do_assign && cache_mode != ResourceFormatLoader::CACHE_MODE_IGNORE) {
|
||||
res->set_path(path, cache_mode == ResourceFormatLoader::CACHE_MODE_REPLACE);
|
||||
res->set_subindex(id);
|
||||
}
|
||||
|
||||
if (progress && resources_total > 0) {
|
||||
|
|
Loading…
Reference in New Issue