- Home /
The question is answered, right answer was accepted
How can I lock the mouse WITHOUT it going to the center of the screen?
How do I lock the mouse cursor, without it going to the center of the screen??
----OLD-----:
How do I show the mouse while it is locked though? I want it locked at its last position, not just the center of the screen.How can I basically teleport the mouse to a certain position? Also, how can I lock the mouse in one position, say the screen, so that it can move enough for the game to recognize its moving but it is staying in one spot?
Is there any way to do this WITHOUT it being overly complected or involving creating a GUI mouse or such?
(Like mousecursor.lock
,or mousecursor.transform.position
?)
Answer by IvovdMarel · Feb 23, 2015 at 12:58 AM
Screen.lockCursor = true;
Thanks, works great! That was the quickest answer I have ever received! Just wondering though, is there a way to move the cursor to a certain position?
To answer your other question - I think you'd have to create your own GUI $$anonymous$$ouse but that's not overly complicated.
Google "custom cursor unity" brings up quite some answers.
You'd have to lock it the moment you click and probably use Screen.showCursor = false so there will only be one cursor visible
Follow this Question
Related Questions
Disable Player Controller/Camera when GUI is displayed? 1 Answer
Check if mouse cursor is locked 1 Answer
disable script when i press escape?? 2 Answers
How to lock mouse cursor but still move camera 1 Answer
Screen.lockCursor mystery? 1 Answer