hello all,
i didnt know what to name the title other than what im felling about WaitForSeconds
but what i am trying to do is simply play a sound, then right after that has finished, the scene changes to the next one.
now i was absolutely sure this would work, but no matter what, it doesn’t change scene after the sound, or even after the amount of seconds has passed
this is the script that i am writing, and i have gone back and forth but cant figure this out.
now the sound is only a second long as well, so am just making sure it plays then changes to the next scene.
void OnTriggerEnter2D(Collider2D collide){
if(collide.gameObject.tag == "Player"){
AudioSource.PlayClipAtPoint(wonLevel,transform.position);
Destroy(this.gameObject);
NextLevel();
}
}
IEnumerator NextLevel(){
yield return new WaitForSeconds(1);
int i = Application.loadedLevel;
Application.LoadLevel(i + 1);
}
thanks to anyone who can shed some light on this.
cheers