How to get sounds at runtime in my game sounds are attached to NPC.All the sounds attached at runtime to NPCSoldier(clone)

if i do GameObject.Find(“NPCSoldier”).GetComponent() it do not work
if i do
it also dont work!!
please help

I’m assuming you have a script that is attached to all your NPCs am I correct. Maybe one called NPCSoldier or something. Could you not just literally create a public AudioSource and then use audiosource.Play()? So for example, if you wanted the audiosource’s name to be audio1, you could maek a public AudioSource audio1, then in the function you want to play that sound, put audio1.Play().

You will of course need to reference the AudioSource in the script though with the gameobject in the hierarchy.