Audiosource.Play not playing, but causing issues in coroutine
Hey guys,
My name is Benita and I am a code newb.
I have a bursting bubble animation working as I want it to, code looking like this:
public IEnumerator ZapAnimation(){
animatorOil.SetTrigger ("burst");
yield return new WaitForSeconds (1);
Destroy (oilBubObj);
I have an AudioSource named "bubble" declared at the top of the class. When I add bubble.Play() to the coroutine, the AudioSource never plays, the Animator gets stuck in a loop, and the object is never destroyed:
animatorOil.SetTrigger ("burst");
bubble.Play ();
yield return new WaitForSeconds (1);
Destroy (oilBubObj);
I'm using the same AudioSource for button presses in other scenes, and it works fine. The clip is about a second long, and is not set to loop/
Appreciate all the help I can get :)
Answer by mcarney82 · Aug 08, 2016 at 03:56 AM
Were you able to get your audio to play? I'm having a similar issue myself.
Your answer
![](https://koobas.hobune.stream/wayback/20220612083742im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
One Audiosource catchy/lagging, two working 1 Answer
Determine end of audio clip if paused and resumed inbetween? 1 Answer
Need to Change Sprite Color in Coroutine Using LateUpdate 0 Answers
How would I check if an audioclip assigned to another object is playing? 0 Answers
Reset animation in animator when execution the same animation in row 0 Answers