- Home /
Restrict the cursor to a window in Unity 5
I want to create an RTS like camera scroll and it would be very bad if the mouse could leave the window.
Cursor.lockState = CursorLockMode.Confined;
First this doesn't work in the editor at all, which is a bit annoying but not the biggest problem. The real problem is that it doesn't really constrain the cursor even in the built version.
The cursor can still move on top of the title bar on windows which could be very bad.
Is it possible to constrain the cursor to a window without using Pinvoke+win32api?
Comment