how do you actually stop a game?

I've got level 1 finished and I'm trying to end Level 1 and start Level 2...how do I do that? I don't know how to end my game. Is there a special script or technique for ending a game...or moving up a level?

When the player gets 10 points, the level should take the player from level 1 to level 2.

or

If time runs out, restart the current level. I had no internet all weekend so I tried everything I could with what Unity comes with. Made it far, but really need a place like this to ask the questions so my game can finish!

Please let me know. Much Appreciated +_+ Thanks!

Use a point system such as:

var score = 0;
var scoreText = "Score: 0";
var mySkin : GUISkin;

function OnTriggerEnter( other : Collider ) {
    Debug.Log("OnTriggerEnter() was called");
    if (other.tag == "Asteroid") {
        Debug.Log("Other object is a coin");
        score += 25;
        scoreText = "Damage%: " + score;
        Debug.Log("Score is now " + score);
        Destroy(other.gameObject);
        GameObject.Find("Main Camera").animation.Play();
    }
}

function OnGUI () {
    GUI.skin = mySkin;
    GUI.Label (Rect (100, 10, 500, 200), scoreText.ToString()); }

    function Update(){
        if( score == 100){
            Application.LoadLevel(0);
        }
    }

The Script counts (damage or Points) then:

if( score == 100){

sees if my score or damage in this case is 100 (score is a number variable).

Now that the script or your score script sees that the score is 100 or what ever you set it to it uses:

Application.LoadLevel(0);

Application.LoadLevel loads level that is defined as number 0 in the player settings(0 can be change to level you want). Then it loads the level defined by the number(0 in my case).

-Hope this helps. Comment if you need anymore help or explanation.

First thing you need to do is go to, File->Build Settings and add all your levels there so you can switch in between levels.

Now, say your playing level 1 and time tuns out, you could do something like,

if(time<=0)
Application.LoadLevel("1");

Similarly if the player completes the level on time and you want to switch to level 2, you would do `Application.LoadLevel("2");`

To quit an application, say end game,you would do something like, `Application.Quit();`

For more information on using these methods, check out this link

http://unity3d.com/support/documentation/ScriptReference/Application.html

Hope this helps

Create your Level 2 as a new scene, save it. Add the scene of Level 1 and 2 to the Build Settings. (File > Build Settings... > Add Current) Make sure they are in the order you want them to be (Level 1 is at the top, Level 2 is below). Drag and drop entries in the list "Scenes in Build" to change the order.

Put the script below in any game object in Level 1.

Change the value of score everytime the player gains points. Change levelTime to the number of seconds the timer should be in.

var levelTime = 10.0;
var score = 0;

function Start()
{
   Invoke("GoToNextLevel", levelTime);
}

function GoToNextLevel()
{
   Application.LoadLevel(Application.loadedLevel+1);
}

function Update()
{
   if (score >= 10)
   {
      GoToNextLevel();
   }
}