Skip to content

Instantly share code, notes, and snippets.

@poemdexter
Last active August 29, 2015 13:57
Show Gist options
  • Save poemdexter/9352481 to your computer and use it in GitHub Desktop.
Save poemdexter/9352481 to your computer and use it in GitHub Desktop.
Lock mouse cursor on screen
void Start()
{
Screen.lockCursor = true; // lock mouse cursor on screen at start
}
void Update()
{
if (Input.GetMouseButtonDown(0)) // keep mouse cursor locked when we come back (left click)
Screen.lockCursor = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment