Commit 1382cf18 authored by limingzhe's avatar limingzhe

fix: debug 清缓存

parent 7ce080df
......@@ -450,16 +450,10 @@ export abstract class middleLayerBase extends cc.Component {
console.log('asset_uuid: ', asset._uuid);
console.log('asset: ', asset);
try {
// asset.decRef();
while (asset?.refCount > 0) {
asset.decRef();
}
cc.assetManager.releaseAsset(asset);
asset.destroy();
} catch (error) {
console.log('try catch error: ', error);
while (asset?.refCount > 0) {
asset.decRef();
}
// asset.decRef();
// cc.assetManager.releaseAsset(asset);
......@@ -478,9 +472,22 @@ export abstract class middleLayerBase extends cc.Component {
while (texture?.refCount > 0) {
texture.decRef();
}
});
[ ...this.assetList ].forEach(asset => {
console.log('asset_uuid: ', asset._uuid);
console.log('asset: ', asset);
cc.assetManager.releaseUnusedAssets();
// asset.decRef();
// cc.assetManager.releaseAsset(asset);
// asset.destroy();
});
// this.atlasList.length = this.assetList.length = this.nodeList.length = this.textureList.length = 1;
......
......@@ -5914,6 +5914,9 @@ declare namespace cc {
释放所有资源。详细信息请参考 {{#crossLink "AssetManager/releaseAsset:method"}}{{/crossLink}}
*/
releaseAll(): void;
releaseUnusedAssets(): void
}
/** `cc.loader` is deprecated, please backup your project and upgrade to {{#crossLink "AssetManager"}}{{/crossLink}} */
export class loader {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment