onedayitwillmake Posted October 25, 2013 Share Posted October 25, 2013 Does phaser have a function to purge unused textures, or if not, how can I manually remove a texture from phaser - for example if I have some textures for the start screen of my game, and some textures for the gameplay section. The reason is that on mobile the game is running out of video memory, however it's only because I cannot purge the textures that I am no longer using. Link to comment Share on other sites More sharing options...
rich Posted October 25, 2013 Share Posted October 25, 2013 You would use Cache.removeImage, or Cache.destroy to nuke them all. If you've still got a reference to the image elsewhere then it won't be garbage collected, otherwise that should be enough to nuke it. What I'm thinking of doing in a future version is recycling the Image objects in the Cache, so if you delete one then load a new image it re-uses an existing DOM node. That should help. Link to comment Share on other sites More sharing options...
onedayitwillmake Posted October 26, 2013 Author Share Posted October 26, 2013 Interesting approach, are you talking about creating an ImageElement via 'new Image();' and storing it as a reference?Also thanks for the info about Cache.removeImage Link to comment Share on other sites More sharing options...
rich Posted October 27, 2013 Share Posted October 27, 2013 Yes, exactly that. Link to comment Share on other sites More sharing options...
Recommended Posts