- Home /
Lock mouse to application.
I've tried using the
Screen.lockCursor
method that should lock the cursor into the center of the screen, now this works while my mouse is in the game window; However if I'm in windowed mode and I move my mouse outside of the game window and click, it will click outside of the game, thus causing a problem.
This also happens while running the game in fullscreen, if I move my mouse to my other monitor I can click out of the game.
Answer by mwbranna · Oct 17, 2014 at 09:37 PM
Unfortunately this is controlled by Windows (or whatever OS you are running) not Unity.
This thread goes into details on fixing it for Windows, and in general you can keep Screen.lockCursor=true and Screen.hideCursor=true then implement your own custom mouse pointer based on mouse input, while the "real" cursor is locked and hidden.