Simple way to make an event happen when an audio track ends

I need to trigger an option to re-load the level or continue to the next level when my audio track ends. How would you go about this? Thanks!

Written in browser, untested…

function Start(){
     PlayAudio();
}

function PlayAudio(){
     audio.Play();
     while(audio.isPlaying){
          yield; //if the audio is playing, don't do anything
     }
     //when script gets to here, the audio has stopped playing - load your level
}

Thanks, I’ll try this today :slight_smile: