sta-ger Posted March 15, 2019 Share Posted March 15, 2019 Hi, I'm trying to build a Texture using PIXI.Spritesheet with manually loaded img and json. baseTexture = new PIXI.BaseTexture(img); pixiSpriteSheet = new PIXI.Spritesheet(baseTexture, json); pixiSpriteSheet.parse(() => { console.log("Parsed"); }); If i do this several times with different images I'm getting a warning message: "Texture added to the cache with an id [0] that already had an entry". After some investigations I've found that parsed textures are always adding to cache with frame idx as a key. Spritesheet.prototype._processFrames = function _processFrames(initialFrameIndex) { ... _.Texture.addToCache(this.textures[i], i); ... } Every time when parsing a new sprite sheet the cached textures will be overwritten by new with the same index. Looks like any texture must have a unique ID when caching but it doesn't... Is it a normal behaviour or am I doing something wrong? Is it possible to disable this warn message even if this is normal? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 15, 2019 Share Posted March 15, 2019 In that case, index is name of the texture inside spritesheet. If you have that kind of problems, throw the cache out, do "PIXI.utils.clearTextureCache" or something ( i dont remember), because that cache exists only for "from" and "fromFrame", "fromImage" methods, pixi doesnt actually need it Quote Link to comment Share on other sites More sharing options...
sta-ger Posted March 18, 2019 Author Share Posted March 18, 2019 On 3/15/2019 at 6:49 PM, ivan.popelyshev said: In that case, index is name of the texture inside spritesheet. If you have that kind of problems, throw the cache out, do "PIXI.utils.clearTextureCache" or something ( i dont remember), because that cache exists only for "from" and "fromFrame", "fromImage" methods, pixi doesnt actually need it Cool! Throwing out the cache was helpful, thanks a lot! ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.