Level Map not working!

when i collide with the castle at the end of level 1 i go back to the level map nd the next level should be unlocked but it's not. i have a gameobject in level one that isn't destroyed on a after loading a new level. this script is attached to it:(lvlmaplvlendScript)

static var level = 1;

function OnTriggerEnter(hit : Collider)
{

      if(hit.tag == "Levelending")
    {
        level = 2;  
    }   
}

function Awake()
{

      DontDestroyOnLoad(this);  

}

basically what it does is when i collide with the castle the variable level becomes 2.

the following script is attached to (on my level map i have to orbs for each level; the gray ones mean level isn't unlocked yet and the yellow ones means they are.(yellows are not active to begin with, they become active through the following script.)) the yellow orb for level two:(level2selectScript)

gameObject.active = false;

if(lvlmaplvlendScript.level == 2)
{

       gameObject.active = true;    
}

function OnMouseUp()
{

       Application.LoadLevel("lvl 2");  
}

but the level two yellow orb does not become active after i collide with the castle at the end of level 2.(P.S. I get no errors!)

could someone PLEASE help me with this problem? I been trying to fix this for a long time now and i just couldn't do it. Help with this issue will be GREATLY, AWESOMELY, and EXTREMELY appreciated. Thanks for the help!

Have you checked, that the castle is tagged "Levelending"?

To see the level value easily in the inspector till you solved the problem, you could use a second public variable:

static var level = 1; var levelvalue : int;

and in the Update function

levelvalue = level;

So you could exclude the level setter if thats working fine, and the level var is 2 after the collision. Also, you could try to set the gameObject directly true with script, making the gameobject a static variable and: lvlmaplvlendScript OnCollisionEnter function, in the if statement

level2selectScript.gameObject.active = true;

function OnCollisionEnter (hit : Collision)
{
if(hit.gameObject.tag == "Type the tag here")
   {
   Application.LoadLevel("Type the name of the level you want to load")
   }
}

Dose this work?

Attatch this script to your "player".