Change the audio asset

I would like to change the asset at run time using the name of the asset, I am trying this:;
myEntity.sound.slot(0)._asset: = ‘Q10-A3-ogg’;
Can someone give me a way?

asset = this.app.assets.find (“Q10-A3-ogg”);
the asset returns to me, but its ID does not return to me.

ex:console.log(asset); //null

thanks

asset id can be fetched by

assetName.id

So you just need to assign sound slot the asset id and it will work.

So in your case it will be

var asset = this.app.assets.find ("Q10-A3-ogg");
myEntity.sound.slot("answer").asset = asset.id;
2 Likes

THAAAAANNNKKKKSSSSSSSS \ o /