Search Unity

loading multiple levels error

Discussion in 'Scripting' started by keith400, Apr 13, 2011.

  1. keith400

    keith400

    Joined:
    Mar 30, 2011
    Posts:
    49
    var isQuitButton = false;

    function OnMouseEnter()
    {
    //change color of text
    renderer.material.color = Color.red;
    }

    function OnMouseExit()
    {
    //change color of text
    renderer.material.color = Color.white;
    }

    function OnMouseUp()
    {
    //are we dealing with a quit button?
    if( isQuitButton )
    {
    Application.Quit();
    }
    else
    {
    //load levels
    Application.LoadLevel(1); //this is my game scene

    Application.LoadLevel(2); //this is my credits scene

    Application.LoadLevel(3); //and the instructions scenes level 3 always pop up when i click level 1 or 2
    }
    }
     
  2. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    What are you trying to do? You're loading the first level, then instantly unloading it and loading the second, then unloading that and loading the 3rd. Seems like it's doing exactly what you're telling it to do.