Clear cached data when scene is destroyed.`

Hello everyone,
Is there way to clear cached data of a scene when it is destroyed? I have multiple scene and when I load from scene A to scene B, I need to remove data of scene A from cache.
In cocos2d purgeCachedData() will Removes cached all cocos2d cached data. It will purge the cc.textureCache, cc.spriteFrameCache, cc.animationCache. Is there a similar function available in creator? The game is developed for web platform.
Cocos creator version 2.4.4

Thank You.

I can ask engineering to review this topic.

1 Like

I have applied AutoReleaseAssets to all the scenes but this doesnā€™t seem to remove the cached resource when switching to other scenes. According to this, it says, For Web platforms, resources cache are managed by the browser after download, not the engine.
And I want to about cc.macro.CLEANUP_IMAGE_CACHE , what does it do, like will it delete image cache once the scene is switched? And also does it affect the game if we switch to other tabs or minimize the browser and come back again?
Thank you

AutoReleaseAssetsļ¼šTo prevent rendering or other problems caused by incorrectly releasing resources being used, Creator will perform a series of checks before auto-releasing resourcesļ¼ŒIf the reference count of the resource is 0, that is, there are no references to it elsewhere, then no follow-up check is required, the resource is destroyed directly and the cache is removed.
Reference Documentļ¼šRelease Of Resources Ā· Cocos Creator

Whether to clear the original image cache after uploaded a texture to GPU. If cleared, Dynamic Atlas will not be supported.
Normally you donā€™t need to enable this option on the web platform, because Image object doesnā€™t consume too much memory.

If you switch to another tab or minimize the browser, it is understood that the game operation will be paused. This can be done with the following events., function () {}), function () {})

1 Like