- Home /
need help about playing sounds
Do I really have to attach sounds to the scene if I want to use them? for example I created an object in the scene and then attached sounds to it. and it's the script.
public AudioSource[] a1;
public void Talk1(){
a1[0].Play();
}
public void Talk2(){.
a1[1].Play();
}
is there any better way to do this without attaching sounds to the scene?
Answer by Unseenpotato · Dec 10, 2017 at 04:18 PM
Add an audio source component to the object you want to play the sound then drag the track to the AudioClip box Hope this helps
thanks but it seems that in this case I can only play 1 sound.for example if I have 3 sounds then how can I play them with audio source component ?
https://answers.unity.com/questions/175995/can-i-play-multiple-audiosources-from-one-gameobje.html
This is a link to a similar situation and there is a much better answer on it. Hope that helps you more and good luck
Nice ,yes it totally helped .But it seems that I have to attach lot's of audio Source components to the object.
Your answer
![](https://koobas.hobune.stream/wayback/20220612144328im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sound on Collision script. 2 Answers
.Shift() error 0 Answers
how to share sound to the network using PUN? 0 Answers
Buttons sounds are only playing once, then the sound no longer plays? 0 Answers
I'd like to make my object chase another one of my objects. 1 Answer