- Home /
How Can I Lock The Cursor Position?
Hello, I am working on an FPS game and cannot get the Cursor.lockState code to work. Yes, I have read the documentation page, but I have not been able to remove the GUI elements the script has. I have not been able to successfully recreate or modify the code, and I do not feel the documentation gave enough information for me to accurately understand the true workings. If anyone can help me, it would be greatly appreciated!
Answer by Ady_M · Jan 05, 2019 at 09:51 PM
Have you tried with only these two lines and nothing else?
private void Awake ()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
Thank you for the reply! For some reason, I could not get that exact code to work in the Start method. Luckily it works now, so thank you!
You're welcome :) Remember to accept the answer so others (and myself) know it's been solved while looking through the list.
Your answer
Follow this Question
Related Questions
How Do I Lock the Cursor to the Center of the Screen? 1 Answer
How to prevent mouse lag/latency for custom cursor? 0 Answers
Make image follow your cursor 1 Answer
How to get the current cursor texture? 0 Answers
[4.6] Dynamic Images in UI 1 Answer