Change the sprite when mouse over

Inside the script code I want add the possibility to change its sprite.

So the player mouseover the sprite,it changes into the other sprite already added to the project.

Can you provide me a sample code to do this?

var newSprite : Sprite;


function Start () {


 print(gameObject.name);

}

  void OnMouseEnter() 

  {

   print("hii  detected");
   //targetGui.texture = hoverTex;


  GetComponent(SpriteRenderer).sprite = newSprite;			
    }

   void OnMouseExit() 
	{

        }

This is not working

Change void OnMouseEnter() + void OnMouseExit() to, function OnMouseEnter(), function OnMouseExit.

The reason it doesn’t work is because you are using C# in your Java Script.