Reputation: 105
It's a simple question, but how do I lock the cursor and hide the cursor in my Unity games?
Upvotes: 1
Views: 4078
Reputation: 11
It is better to use this:
void Start()
{
Cursor.visible = true;
}
Because Screen.ShowCursor is deprecated.
Upvotes: 0
Reputation: 9731
As of Unity 5.2, you should use the Cursor
class.
Static Variables
lockState
How should the cursor be handled?
visible
Should the cursor be visible?
Upvotes: 6
Reputation: 172578
You can try like this:
void Start ()
{
Screen.showCursor = false;
}
ie, try to add Screen.showCursor = false
inside the Start function. This will hide the cursor from the entire game.
Also refer: Screen.lockCursor
Upvotes: 1