- Home /
Question by
SeaPeaMe · Oct 31, 2017 at 09:49 AM ·
c#unity5lock-cursor
How to unlock the cursor
Hey guys!
I need to know how to unlock the cursor. I've seen many others related to this question but they never work or answer my question.
Thanks! My code:
if (Input.GetKeyDown (KeyCode.Escape)) {
if (Cursor.visible = true) {
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
} else {
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
Comment
Answer by Desoro · Oct 31, 2017 at 11:42 AM
Most likely you are doing this in the Editor? The Editor will unlock the Cursor when you press the ESC key so, well... you can use the Editor. Try using a different Input to toggle it and you should be just fine.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to control damage output. 0 Answers
How to create a Drop Down menu for a script file? 1 Answer
Separate Objects after Mouse Clicking in Unity 5.6.4 1 Answer