Search the Community
Showing results for tags 'unload'.
Found 3 results
Hi peeps, posted this in the Common Phaser & CocoonJS issues topic as well, but no answer as of yet. This is what's keeping me from finishing the game pretty much so felt like I had to make it it's own topic as well. I've been having some struggles with memory as of late. At first I loaded everything in preload.js which worked fine in my other smaller games, and I use shutdown() for the first time and clear every object when leaving a state which certainly makes the game smoother. But then when making my third world for the game I recieved memory warnings. So I decided to load the necessary parts of each world in their preload-functions, now the problem I'm having is removing them when entering a new one. Say when I'm done with world 1 and enter world 2, I want to clear the loaded assets only used in world 1. I've tried cache.removeImage(key), which alone did not quite work as I'd like, since it doesn't quite clear it right away. Then I've read about cocoons feature .dispose() which I then tried like this: cache.getImage(key).dispose() cache.removeImage(key) I've tried in some other orders too, and a little with PIXI(but since that's part of removeImage I didn't look that much into it), but long story short(er); what's the best way to clear assets from memory, using cocoon and phaser, since I want to load them every time I enter each world. I don't want to do it in an incomplete way like I did with removing objects from states before. Cheers!
Hello, I have been wondering what is the best way to manage assets in Phaser. From all examples and tutorial I have seen, most of them only loads the assets needed, and never unload them. If my game use heavy assets, there should have been a way to manage assets in memory (load and unload them), but in previous thread I have read, it is said that clearing assets from cache does not actually unload them from memory, due to it is still used by internal pixi system. So, how do I load/unload assets properly in phaser? since I am pretty sure not clearing the assets will inevitably create out of memory error. Thank you.
Hi! So here's something that has been bothering me for a while... Can we somehow "unload" textures/texture atlases/assets? I'm working on a game that has multiple levels. At the start of each level, I preload all of the assets the level requires using the AssetLoader. So at the start of the first level I have something like: loader = new PIXI.AssetLoader(["level1_assets.json"]);loader.onComplete = startLevelloader.load();While at the start of the second level I have something like: loader = new PIXI.AssetLoader(["level2_assets.json"]);loader.onComplete = startLevelloader.load();The point is, once the first level is over, I will never again need the texture atlas used to store its assets (resp. "level1_assets.json"). So there's no need for it to linger in my precious GPU memory anymore! Can I somehow dispose of it?