s4m_ur4i Posted October 7, 2018 Share Posted October 7, 2018 Hey, I got some scenes, which loading assets only needed in those, I would like to clear the cache out of the files when a new scene is started so that the memory is free again. But I can't find an example or something in the docs. I had a look at this.scene.cache.destroy(); But when I do this in a constructor: It throws an error that cache is not defined. Or at the first line in preload: it messes up the files that will be loaded afterward. Can anyone help me out regarding this? cheers Link to comment Share on other sites More sharing options...
s4m_ur4i Posted October 7, 2018 Author Share Posted October 7, 2018 I came around with this: for(let type in this.cache) { console.log(type) if (type != 'game') { for (let entry in this.cache[type]) { this.cache[type].remove(entry); } } } It should remove every loaded asset in theory. Maybe someone can give some feedback on it? cheers, Link to comment Share on other sites More sharing options...
Recommended Posts