I am using this script to check when all my “brick” objects are destroyed and then it loads the next level.
function Update(){
var bricks = GameObject.FindWithTag("brick"); //find gameobjects with the tag "brick" (you must therefore tag the enemies with "brick"
if(bricks == null){ //if no gameobjects with the tag "brick" are found
//change scene
Application.LoadLevel(Application.loadedLevel + 1);
}
}
What I want to do is have a delay when all the bricks are destroyed and display “stage complete” (or something like that) and play a sound. I have tried using yield WaitForSeconds (5); I placed it above application load level. But this does not work. I looked at the script reference but was left still confused. Can anyone help me to correctly place it in my script? I’m utter n00b at scripting, design is my strong point.