Weird, I have just tested and I do not experience the problem. It may have some other cause. (I set both the lockState and the visible in Awake)
Also tried with “Input System” and with “Both” setting.
Ok, definitely something to look at. The Cursor API should be unaffected by that switch but could well be there’s something we missed. Filed a ticket here.
Sorry for reviving this thread, but I’m still facing this problem. I’m using Unity 2019.4.6f1 and the New Input System version 1.0.0.
When setting the player settings to use only the New Input System, the cursor remains visible, no matter if I put the Cursor.visible = false and Cursor.lockState = CursorLockMode.Locked. However, if I change the player settings to use both inputs, the cursor’s visibility works as it has to.
Is there any way to fix this using only the new input system?
@Schreilem I’m running into a similar issue, I tried generating a custom transparent texture to “hide” the cursor but that ended up just creating a all black texture on the mouse. I looked into the bug report and its says fixed in 2020.1… which is not useful as I can’t update my project past 2019 for now. How did you end up setting unity to use both inputs? That seems to be the only solution for now…
Obviously you don’t have to call it every frame so it’s not terrible, but as I said, not ideal, and you should remember to set a sprite when you actually need the cursor again. Hope it helps!
Confirming this is still broken. InputSystem v1.1 on Unity 2019.4. No matter what I do, the hardware cursor stays visible, unless I toggle Both for input system usage.
In editor, I can get the cursor visibility to work properly in most cases if I move it into the game view window immediately after hitting the play button.
In builds, however, cursor visibility seems to be broken in most cases (i.e. always visible) - especially when the game runs in windowed mode.
This issue is quite frustrating (I wouldn’t care that much about the editor, but it’s annoying that this also happens in builds). Are there any news about this issue @Rene-Damm ?
I’m using Unity 2020.1.11f1, Input System 1.1.0-preview.2 (but this bug was also present in the verified 1.0.0 package), HDRP 8.2 and the latest UI Toolkit package, just in case this matters…
None of theses workaround are working in the editor for me, @lejean_1 code made the cursor invisible while over the game windows but didn’t locked it in.
Adding Cursor.lockState = CursorLockMode.Locked; did the trick though !
This doesn’t seem to work for me either. It locks the cursor, visibly to the center after 1 second. What does work for me however, is clicking the game view before Cursor.visible is called. This code does help with that (by giving me a 1 second window).
I’m experiencing a similar problem but this time it is with setting the Cursor.lockState to CursorLockMode.Locked. In an empty 2019.4 project I have tested a simple script attached to the main camera that sets the lock state in Update(), but the cursor is free to move. I’ve tested this in the editor as well as the built version of the project. I have replicated the bug on two machines. Am I missing something about how this feature is suppose to work or be set up?