Force mouse to stay "in fullscreen" when in fullscreen mode (multimonitor)

What would be the best way to force the mouse to stay on screen for people using multiple monitors.

I noticed that many released unity games has this issue, that when you keep moving your mouse to one of the sides
you are able to move it over on another monitor, and if you then click (thinking you’re doing some action ingame) it
will result in the game switching to windowed mode, and you have clicked something on the desktop.

I was under the impression that just “hiding the mouse curser” was enough, but clearly it is not.

How do you go around this issue? clambing the screenwidth and height to the mouse or ?

Really interested in hearing what kind of solutions you guys have ? :face_with_spiral_eyes:

i also use 2 monitors and frequently have this issue (not just in unity games!). i have not tried it but can’t you just assign the mouse position? so check if mouse.y is bigger than screen.width and if so create a new vector wich is limited to screen.width. as all games on my windows start on the “primary” monitor (left) i think this is the only coordinate to be checked?

Im on 3 monitors, with my primary in the middle.

I was thinking about

1 - getting screen width
2 - checking mouse pos
3 - Clamp the min/max X post of the mouse to be between the min/max.