Customise in-game cursor

Is there a way to change the look of the cursor in game? and have the cursor look differently based on conditions like mouse over?


There's no built-in function to set a custom mouse cursor, but you can make a script to do it yourself by simply hiding the cursor and drawing your own at the current mouse position. Something like this should work:

var cursorImage : Texture;

function Start() {
    Screen.showCursor = false;

function OnGUI() {
    var mousePos : Vector3 = Input.mousePosition;
    var pos : Rect = Rect(mousePos.x,Screen.height - mousePos.y,cursorImage.width,cursorImage.height);

Just attach it to a GameObject and drag and drop the image you want to use onto cursorImage. To change the cursor from another script, just change the cursorImage variable.

EDIT: As Lance mentioned in the comments below, with this method if your game suffers from low frame rates, the mouse will lag along with everything else. Unfortunately, there is currently no easy way around this that I know of.

These techniques have been rendered obsolete by Unity - Scripting API: Cursor.SetCursor

Ya Unity needs a away to change the hardware cursor. Maybe someone should start a feature request. Unfortunately, I do not think it glamorous enough to get much attention.

Software cursors suck even with high frame rates they create a ghosting effect behind the real cursor.

Just go into project settings > Player > and set the cursor to whatever, then code it.

Happy Developing!

It works fine but you forget to tell one thing:

This script draw the new mouse pointer as a GUI element, so it will be in a Layer. You should set the object with is drawing the new cursor in a Layer that will be above the others layers. If you don’t do this, you mouse will simply dissapear when you aiming something on the GUI. =)