- Home /
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;
}
Comment
If one of the answers below resolved your issue, please don't forget to mark the correct answer.
Answer by Team_26 · Mar 25, 2014 at 05:29 PM
Hi! Did you try:
Screen.lockCursor = true;
?
This command hide your cursor and drag it into the center of the screen.
Answer by Sildaekar · Mar 25, 2014 at 05:30 PM
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.