- Home /
How to prevent mouse from leaving area
Hello! Screen of my game is splitted by two cameras and i want to prevent mouse from leaving the right side of screen. Is it possible? I'm trying to obtain effect like this: https://www.youtube.com/watch?v=Hs3Y7uyOAQk&t=733s Thank you!
You can prevent the cursor from moving at all by changing the Cursor.lockState
If you want to restrict the cursor to a part of the screen, I would suggest creating your own custom mouse cursor that you have full control over, and locking the devices cursor via the lockState above, and hiding it by changing Cursor.visible
Your answer
Follow this Question
Related Questions
Mouse follow on network 0 Answers
3D mouse position 0 Answers
Input.mousePosition Dead Zone - See gameplay 0 Answers
Camera.main.ScreenToWorldPoint works within Unity editor, but not in builds 0 Answers
Keyboard / Mouse control for FPS 0 Answers