Open miltoncandelero opened 1 year ago
Also getting this issue, in addition to what's mentioned above, the check to show the warning is also incorrect I believe
cacheKeys.forEach((key) =>
{
if (this._cache.has(key) && this._cache.get(key) !== value)
{
if (process.env.DEBUG)
{
console.warn('[Cache] already has key:', key);
}
}
this._cache.set(key, cacheableAssets[key]);
});
Where value
is the original asset passed into the function (in this case, the spritesheet) it's comparing each sprite against the sheet to see if they differ, I believe the check should be if (this._cache.has(key) && this._cache.get(key) !== cacheableAssets[key])
Current Behavior
When
Assets
hits the cache for a Spritesheet, it triggers the spritesheet to regenerate all the textures.This could be walked arround by asking if
Assets.get(...)
already has the spritesheet instead of always callingAssets.load(...)
but if your texture is inside a bundle, since there is no way to get the bundle without callingloadBundle
the spritesheet always reparse.Expected Behavior
I think the spritesheet cache should be smart enough to know if it was already parsed or not, or if the parsed textures are still alive or they need reparsing
Steps to Reproduce
Load twice the same spritesheet. The second time you hit the cache but you get warnings about declaring duplicated textures due to the spritesheet parsing again.
See attached repro.
Environment
pixi.js
version: 7.x.xPossible Solution
No response
Additional Information
No response