Jump to content

Purge unused textures


onedayitwillmake
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...