koki
koki

Reputation: 39

Keep the mouse cursor within the game window

How can I make it so that the mouse cursor within the game window so that the cursor won't, for example, go into the other screen if you're using dual screens? I do not want to use the Screen.lockCursor since I want to be able to use the mousepointer inside the game and not make it hidden and centered which you do with the lockCursor function.

Upvotes: 0

Views: 770

Answers (1)

Victor Rasmussen
Victor Rasmussen

Reputation: 86

This might be able to help you Cursor.lockState = CursorLockMode.Confined;

For more information look at the API at https://docs.unity3d.com/ScriptReference/Cursor-lockState.html

Upvotes: 2

Related Questions