Jump to content

Delete loaded files from cache


s4m_ur4i
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

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