- Home /
Question by
user-5681 (google) · Oct 28, 2010 at 04:00 AM ·
mouselock
Lock Mouse to the middle of the screen
I need to lock my mouse in the middle of my screen, kind of like fall out 3 style. Can anyone help. I've already tried. And it doesn't work.
Screen.lockCursor = true;
Comment
Answer by IJM · Oct 28, 2010 at 05:09 AM
It works for me:
void Update()
{
if (Input.GetKey(KeyCode.Space))
Screen.lockCursor = true;
else
Screen.lockCursor = false;
}
"In the web player the cursor may only only be locked after the user has clicked on the content and the user has not left the content view with the cursor"
More @ http://unity3d.com/support/documentation/ScriptReference/Screen-lockCursor.html
Your answer
Follow this Question
Related Questions
Cant unlock cursor with FPS prefab 2 Answers
Cursor lock not working after alt tab 2 Answers
Mouse Lock 1 Answer
How do I do this? 2 Answers
Mouse lock to target 0 Answers