unload() {
if (!this.loaded && this._resources.length === 0)
return;
this.fire('unload', this);
this.registry.fire('unload:' + this.id, this);
const old = this._resources;
// remove resource from loader cache
if (this.file) {
this.registry._loader.clearCache(this.getFileUrl(), this.type);
}
// clear resources on the asset
this.resources = null;
this.registry = null;
this.loaded = false;
// destroy resources
for (let i = 0; i < old.length; ++i) {
const resource = old[i];
if (resource && resource.destroy) {
resource.destroy();
}
}
}
engine/src/asset/asset.js
Lines 490 to 515 in 771201a
to