More simple code not working

What’s up here? I have a button that I press to show/hide a info object. It works the first time I press but not afterwards, I don’t see the problem:

var currenttexture : Texture2D;
var newtexture : Texture2D;
var self : GameObject;
var myCheck : boolean = true;
var info : GameObject;

function OnMouseEnter ()
	{
    self.renderer.Material.maintexture = newtexture;     
	}

function OnMouseExit ()
	{
    self.renderer.Material.maintexture = currenttexture;     
	}

function OnMouseDown () {    
      if(myCheck){
      info.guiText.enabled = true;
      mycheck = false;
     }else{
      info.guiText.enabled = false;
      mycheck = true;
     }
}

Also the first part is supposed to change the button appearance but not working either. Thanks for any help!

I would use a simpler way to toggle the boolean variable - maybe using the guiText.enabled property directly. About the material: you’re writing Material, but it’s material. Try this version:

var currenttexture : Texture2D;
var newtexture : Texture2D;
var self : GameObject;
var info : GameObject;

function OnMouseEnter (){
    // its material, not Material:
    self.renderer.material.maintexture = newtexture;     
}

function OnMouseExit (){
    self.renderer.material.maintexture = currenttexture;     
}

function OnMouseDown () { 
    // toggle guiText.enabled:
    info.guiText.enabled = !info.guiText.enabled;
}