Script nonsense

When a script doesnt work in a new project when it has previously worked fine in many others, what exactly am i supposed to do!!

It gives this error (see attached)

and this is the script, which works fine everywhere else -

static var gotKey : boolean = false;
var key : GameObject;
 
//function to switch GUI Texture on / off 
static function EnableTaggedGUITexture(tag : String, enable : boolean) { 

	//check for an object with a certain tag
   var go = GameObject.FindWithTag(tag); 
   if(go) { 
   	//if found, address its GUITexture component
      var gt = go.GetComponent(GUITexture); 
      if(gt) { 
      // ..and enable it
        gt.enabled=enable; 
      } 
      
      //if not found state that there is no GUITexture on the gameObject
      else { 
          Debug.Log("Error: The GameObject does not have a GUITexture component to enable", go); 
      } 
   } 
   //if no tagged game object matching found, return following statement
   else { 
      Debug.Log("Error: Could not find a GameObject tagged "+tag); 
   } 
} 

function Start(){

	gotKey = false;

	EnableTaggedGUITexture("KeyGUI", false);
		
	Instantiate(key, GameObject.FindWithTag("KeyPlace").transform.position, GameObject.FindWithTag("KeyPlace").transform.rotation);

}

function OnControllerColliderHit (hit : ControllerColliderHit) {
 
	//check and see if the collision has a tag called "key"
	if (hit.collider.gameObject.tag == "key"){
	
	  gotKey = true;
	  EnableTaggedGUITexture("KeyGUI", true);

	  var keyClip = hit.collider.audio.clip; 
      var keypoint = hit.collider.transform.position; 
      AudioSource.PlayClipAtPoint(keyClip, keypoint);
       
      Destroy (hit.collider.gameObject);   
	}
		
	if (hit.collider.gameObject.tag == "health" ){ 
		
      var healthClip = hit.collider.audio.clip; 
      var healthpoint = hit.collider.transform.position; 
      AudioSource.PlayClipAtPoint(healthClip, healthpoint); 
      
      Destroy (hit.collider.gameObject);   
      Health.health+= 20;        
   } 
   
}

Help!

31644--1149--$picture_1_171.png

eek!

I thought all Javascript code derived from Monobehavior, I mostly use C# myself, so I can’t really comment.

I cant drag on any script now, and any new ones I create are not listed in Component > scripts.

So i tried a rebuild.

Now I have no scripts menu. Brilliant.

There must be compile errors in the error console detailing what is wrong and where after rebuilding.

Tried rebuild then dropping scripts onto a GO. It THEN told me to fix errors in ALL scripts, which i did, and now I can add scripts again, Still no scripts menu.

Surely unity shouldnt stop working when you write a script incorrectly!!

N’est pas?

Since there is a compile error in a script, Unity will not be able to compile any changes until the error has been fixed, as the compilation will stop when encountering the erroneous script.

Ive had similar situations. I assume Im just overloading something.
1 Fix errors.
2. Resart unity

And presto, you should be back in the game.
AC