hello everyone! I would like to load a scene when my main character reaches the end of the game to let the player know he has won, and would like to do the same when he loses ( when he collides with a particular object) any ideas? ... thanks a lot!
If the question is "How do I load a scene?" , then you must add the scenes to the File > Build Settings list and then use:
Application.loadLevel(0); //use scene index
Application.loadLevel("GameOver"); //use scene name
function OnCollisionEnter(collision : Collision) { Application.loadLevel("name of the level to be loaded"); }
function OnCollisionEnter (Hit: Collision){
if(Hit.gameObject.tag == " Put your objects tag here"){
Application.loadLevel(" Put you level name here ");
}
}
first thing is first you have to tag your player as "Player" then assign the tag to him. then copy the script add the tag as "Player" and then the level to load name and then save the script and attach it to the object that the player will collide with in order to bring up the win stage :)