- Home /
Load Scene by audio clip
Could someone easily tell me how to load a scene after an audio clip have been played?
Something like:
if (Audiosource.play) Application.LoadLevel(0);
or something, I know what I wrote there won't work but could anyone easily tell me how to make it work?
thx!
Answer by Meltdown · Sep 08, 2011 at 02:17 PM
You can do something like...
var myClip : AudioClip;
myClip.Play();
if (!myClip.isPlaying)
{
LoadYourScene();
}
You might want to use a Co-Routine rather to be safe.
Answer by henry96 · Sep 08, 2011 at 02:17 PM
I believe there is a couple way to solve this issue. However, I know only one. :) First, when the audio is played, make another function, then add yield WaitForSeconds(). Duration of waiting depend on the length of your audio. Then use Application.LoadLevel (); Hope this help. ^^
Yes a co-routine is probably better, but a more robust way would in the co-routine be doing a check if clip.isPlaying == false.
Your answer
Follow this Question
Related Questions
Current scene number 2 Answers
Multiple Instances of My Current Scene? 0 Answers
How can I save the player's progress in-game? 1 Answer
How to see what level is running? 2 Answers
What is the Difference betwwen a "Level" and a "scene" 2 Answers