Changing cursor when mouse is over object?

So right now, when I pause the game, the cursor appears and when I click on a weapon, it is added to my inventory. How do I make it so my cursor changes to a hand while it is over the object? I’m guessing that it uses function OnMouseOver().

Actually, instead of OnMouseOver you would probably want to use OnMouseEnter so that it only calls once instead of every frame - here you have to:

  • hide the cursor : Screen.showCursor = false;
  • change a boolean to true: showCustomCursor = true;

do the opposite in the OnMouseExit function to restore the normal mouse

Then, in the OnGUI function:

var cursorImage : Texture;
function OnGUI() {
    var mousePos : Vector2 = Input.mousePosition;
    var pos : Rect = Rect(mousePos.x,Screen.height - mousePos.y,cursorImage.width,cursorImage.height);
    GUI.Label(pos,cursorImage);
}