- Home /
Cursor gets locked again
After setting Cursor.lockState to None, it will be reset to Locked almost immediately (right after the calling function). But it happens only for one specific event. I have tested it outside the Editor too.
Is there something I should know about accessing Cursor in some parts of code?
PS: Looks like I forgot to set the proper "space" for this question...
Bump. Looks like either nobody has this problem, or nobody thinks it is a problem. Let me assure you that it actually is a problem for me! I can't use the cursor in a large part of my game!
It resets because somewhere in your code you're setting it back to locked. Probably somewhere in update
Thanks for bumping, but I can assure you it is not being set to Locked and definitely not in Update. I know the Cursor stuff is already a bit wonky in Unity, but this is too much.
Answer by ZeroComfort · Mar 09, 2018 at 01:34 PM
Thanks for all the effort @Harinezumi. Looks like there was one rogue duplicated function call in the player controller that I missed that was causing the issue after all. I don't know how I could have missed it because I don't even remember placing it there.
In the end it was another place calling Cursor.lockState
. Great that you solved it!
Your answer
Follow this Question
Related Questions
How Do I Lock the Cursor to the Center of the Screen? 1 Answer
How Can I Lock The Cursor Position? 1 Answer
Keep cursor enabled 2 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers