Search Unity

Levels!

Discussion in 'Scripting' started by Pheonixx, Apr 21, 2014.

  1. Pheonixx

    Pheonixx

    Joined:
    Apr 19, 2014
    Posts:
    8
    Hi all,
    Again I have a problem. I've made this script and it gives me an error saying
    Unknown identifier : 'Level2'
    I have my Level1 and Level2 scenes both in the same folder as well. And I made sure that I got the name correct. The only issue I can think of is that I'm not using Monodevelop and am using Notepad++ instead. Is that an issue and can you please help me fix this script.

    #pragma strict

    var Level = "";

    function OnTriggerStay(other : Collider){
    if(other.tag=="player"){
    if(Input.GetKeyUp("up"))
    {
    Application.LoadLevel(Level2);
    }
    }
    }

    THANKS!!!!
     
  2. DanielQuick

    DanielQuick

    Joined:
    Dec 31, 2010
    Posts:
    3,137
    I'm assuming the scene you want to load is named Level2, in which case it would be:
    Code (csharp):
    1.  
    2. Application.LoadLevel ("Level2");
    3.