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
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
CLEANUP_IMAGE_CACHEļ¼
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.
cc.game.on(cc.game.EVENT_HIDE, function () {})
cc.game.on(cc.game.EVENT_SHOW, function () {})