var myLevel : String;
i want when my player hit the gameodject End load the scene in 5 second
function OnCollisionEnter (myCollision : Collision) {
if(myCollision.gameObject.name == “End”){
Application.LoadLevel(myLevel);
}
}
var myLevel : String;
i want when my player hit the gameodject End load the scene in 5 second
function OnCollisionEnter (myCollision : Collision) {
if(myCollision.gameObject.name == “End”){
Application.LoadLevel(myLevel);
}
}
I assume you want to know how to " wait for 5 seconds before load the scene ". Anyway, There are a couple of ways to do so. You can just make another function and use the yield WaitForSeconds ();
For instance :
var myLevel : String;
function OnCollisionEnter (myCollision : Collision) {
LoadAScene (); //Your new function
}
function LoadAScene () {
yield WaitForSeconds (5); //To make it wait for 5 seconds before continue
Application.LoadLevel (myLevel);
}
Hope this help!