I have this script thats meant to move a sprite around the scene. It works but I have to keep clicking the button to move the sprite around rather than just hold the mouse down over the button. How do I change it so I can hold the mouse down over the button and have the sprite move.
var player : GameObject;
var speed : int;
function Up() {
player.transform.Translate(Vector2(0,1) * speed);
}
function Down() {
player.transform.Translate(Vector2(0,-1) * speed);
}
function Left() {
player.transform.Translate(Vector2(-1,0) * speed);
}
function Right() {
player.transform.Translate(Vector2(1,0) * speed);