Kraghen Posted May 23, 2019 Share Posted May 23, 2019 Hi. I load a bunch of image files into my app with Loader: let loader = new PIXI.Loader(); loader.reset(); loader .add(pinImagePath) .add(whiteCircle24Path) .add(whiteCircle64Path) .add("images/crosshair.png"); loader.load(setup) The PIXI app is part of a larger HTML application and it may get initiatet and destroyed multiple times. My problem is when i load the app the second time i get warnings that the Texture already have en entry: "Texture added to the cache with an id [images/circle24.png] that already had an entry" I can see the image is already present in the texture Cahe PIXI.utils.TextureCache[images/circle24.png] But using Loader i would like to get the texture from Loader.resources[], but that one is empty if i dont load it again...? Quote Link to comment Share on other sites More sharing options...
jonforum Posted May 23, 2019 Share Posted May 23, 2019 did you clear before ? PIXI.utils.clearTextureCache(); Quote Link to comment Share on other sites More sharing options...
Kraghen Posted May 24, 2019 Author Share Posted May 24, 2019 20 hours ago, jonforum said: did you clear before ? PIXI.utils.clearTextureCache(); No. That might be the way... But whats the purpose of the cache if I have to clear it all the time? Seem like I can only load cached images when using fromImage() ... In other words, how do I load cached images when using Loader.resources ? let texture = PIXI.loader.resources["image"].texture; // does not look in TextureCache Quote Link to comment Share on other sites More sharing options...
bisrat8 Posted April 26, 2022 Share Posted April 26, 2022 you could just load it like this loader.resources["image"] || app.loader.add("image") 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.