This do not work for me! Will get a crash. The asset as a tag on it. In my case it’s a json with tag config. Loaded or unloaded, it does not make a difference.
var assetToRemove = app.assets.get(assetId);
app.assets.remove(assetToRemove);
Thanks
remove: function (tag, item) {
if (!this._index[tag])
return;
if (this._key) {
if (!this._index[tag].keys[item[this._key]])
return;
}
`var ind = this._index[tag].indexOf(item);` ///crash here
if (ind === -1)
return;
this._index[tag].list.splice(ind, 1);
if (this._key)
delete this._index[tag].keys[item[this._key]];
if (this._index[tag].list.length === 0)
delete this._index[tag];
},
Aha, I think I’ve stumbled on this bug a couple of years ago
Thought it was fixed if we are talking about that same issue. Is it easy to provide a sample project that reproduces the issue? You can submit an issue about it in the engine repo.
In the meantime, removing that asset prior of removing the asset does it work for you?