Sound Component question - change file in script

I have a doubt about the sound component. is possible to change the .wav file from component in script, to make things more dynamic ?

exemple:
image

but this return me a error

imagine that i need to create 50 differents objects in game each object has a unique sound, i can use a factory to create and change the texture for each object. but and about the sound ? its possible to change the componente audio file for each object ? or i need to create each sound component manualy ?

sorry for any grammar errors

You need to create the components manually in the editor (or open the .collection/.go file in a text editor).

I would recommend that you put all sounds in a single game object that is always loaded. Your game objects can then play the sounds they need from this game object:

-- elixir.script
sound.play("allsounds#wand")

The benefit of having all sounds on one game object is that you can stop all sounds at once:

msg.post("allsounds", "stop_sound")
1 Like

thank you now things make sense xD

1 Like