Hey everyone!
I’m having a problem with hiding the cursor and locking it in the middle of the screen. It works at first but when I press esc it comes out of it and won’t go back in.
Here’s the code I am using to try and make this work :
void Update()
{
//Cursor Lock/Unlock//////////////////////////////////////////////////////////////////////////
if (Input.GetKeyDown(KeyCode.Escape) && cursorUnlocked == false)
{
cursorUnlocked = true;
Screen.showCursor = true;
Screen.lockCursor = false;
}
if (Input.GetKeyDown(KeyCode.Escape) && cursorUnlocked == true)
{
cursorUnlocked = false;
Screen.showCursor = false;
Screen.lockCursor = true;
}
/////////////////////////////////////////////////////////////////////////////////////////////
}
Thanks for your help guys!