Unity 2020+ Project: Cursor Lock Requires Additional Click
I've seen one other variation of this question in regards to this issue from a few years back titled "Cursor Lock requires an additional click" that received no assistance.
I am now running into that same issue in 2021. I have pinpointed this issue in my particular instance as being a direct result of a change in functionality from Unity 2019.3.13f1 to Unity 2020.3.8f1.
I have 2 projects that in every aspect (assets, scripting, name, etc.) are the exact same project, but one is running on 2019.3.13f1 and the other is running on 2020.3.8f1.
Behavior | 2019: Upon clicking the play button the following code...
"Cursor.lockState = CursorLockMode.Locked;"
...automatically locks the cursor to the Game window and does not allow you to click on the inspector unless you press the Esc key. This is the functionality I wish to restore.
Behavior | 2020: Upon clicking the play button the following code...
"Cursor.lockState = CursorLockMode.Locked;"
...causes the cursor stays in the exact same position over the play button. The game is still receiving the X and Y mouse axis, but the cursor is allowed to move freely about the inspector. In order to activate the true mouse lock as seen in earlier versions of Unity the user must click within the game window. While in this state of free movement outside of the game window, all mouse button clicks are registered outside of the game window.
VIDEO EXAMPLE: https://www.youtube.com/watch?v=0nasv4CGepE
Desired Solution: If there is a way to regain the earlier Unity version functionality please let me know. In my opinion it was much more intuitive. Or if a Unity Dev sees this can that functionality please be added into later versions.
There are absolutely no differences between the project used. In one instance I actually used the same project for testing. I had the desired functionality, updated to Unity 2020, and lost that functionality. I'm sure this is probably actually some kind of desired functionality on part of the Unity development team, but it seems to be an issue with a few other people other than me.
Thank you.