only release non-gc asset in editor (#7871)

* only release non-gc asset in editor

* refine

* refine
This commit is contained in:
Santy-Wang
2020-11-25 21:16:01 +08:00
committed by GitHub
parent b5384bdc5d
commit cd5605c3eb
+6 -2
View File
@@ -34,7 +34,8 @@ import Cache from './cache';
import dependUtil from './depend-util';
import { assets, references } from './shared';
import { legacyCC } from '../global-exports';
import { EffectAsset } from '../assets/effect-asset';
import { ImageAsset } from '../assets/image-asset';
import { TextureBase } from '../assets/texture-base';
function visitAsset (asset: Asset, deps: string[]) {
// Skip assets generated programmatically or by user (e.g. label texture)
@@ -247,7 +248,10 @@ class ReleaseManager {
this._free(dependAsset, false);
}
}
asset.destroy();
// only release non-gc asset in editor
if (!EDITOR || (asset instanceof ImageAsset || asset instanceof TextureBase)) {
asset.destroy();
}
dependUtil.remove(uuid);
if (EDITOR) {
references!.remove(uuid);