Hide mouse cursor.

Hi guys, i did this script for hide the mouse cursor when i press the right button of the mouse, but it don’t work… why?

#pragma strict

function Start ()
{
Screen.showCursor = false;
}

function Update () {

if(Input.GetMouseButtonDown(1))
Screen.showCursor = true;

else
Screen.showCursor = false;

}

Hi! Did you try:

Screen.lockCursor = true;

?

This command hide your cursor and drag it into the center of the screen.

That’s because you have it placed in the update function. So every frame, if you are not pressing the mouse button it will “unhide” the cursor.

You need to make it so that one button will hide it, and one button will show it if you plan on doing it this way.