Help with OnMouseEnter in Unity2D?

I am working on a main menu, and I want to be able to change a sprite of game object when you hover over it, and then return to it’s original state when your cursor exits the collider. It has a polygon collider. Just to make sure it works, I am using Debug.Log() instead of changing the sprite. I have looked around a i bit on the internet, but still no success.

var Default_Sprite : Sprite;

var Hover_Sprite : Sprite;

  • function OnMouseEnter() {

    gameObject.GetComponent(SpriteRenderer).sprite
    

    = Hover_Sprite;

    }

  • function OnMouseExit() {

    gameObject.GetComponent(SpriteRenderer).sprite
    

    = Default_Sprite;

    }