This has frustrated me since moving from 2019 LTS to 2021 LTS. I figured I’d eventually just get used to the new way things work, but it’s been about a year, and I still deal with this annoyance every day.
Previously, under 2019.X versions of Unity, hiding the mouse cursor worked fine when entering play mode. You’d do something like this:
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
Enter play mode, the cursor goes away, and you start playing.
But started in Unity 2020, and in all versions since then, this code no longer works as-is. Instead, you first need to click somewhere into the Game view to get the mouse cursor to go away. Every single time I enter play mode, I need to click the Game view.
Making this even more annoying is that until you click the game view, the mouse cursor’s hovering all over the Editor, and if you’re not careful, your first click might land on the “X” to close Unity, the Play button (so you cancel Play mode immediately) or some other part of the Unity UI that you had no intention of clicking.
I’d be happy with some kludge to hiding the cursor, if anyone knows of a way, but so far I’m unaware of one. I’m really tired of needing to perform this extra click every time I enter play mode.
FWIW, I initially reported this as a regression bug, but Unity responded it’s intentional, and will not be fixed.
Can we please have some way to hide the cursor when entering Play mode?