I am trying to load a scene after 3 seconds of playing a sound, however as soon as I add a yield statment - the sound does not play. Is there another way around this? Thanks! Code (csharp): function OnCollisionEnter () { guiComment.text = "you win!!! " ; if (audio !audio.isPlaying) { audio.Play (); } yield WaitForSeconds(3.0); Application.LoadLevel("CarnScreenStart"); }
At the moment Event handlers eg. OnCollisionEnter can not be coroutines. (A function using yield is a coroutine) I am hoping to get this bug fixed for 1.1.1. As a workaround you could create another function which does the yield thing and call it using StartCoroutine.