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