Lock mouse position with a Rect, possible?

I've been breaking my head looking for a way to lock the possible position of the mouse inside a Rect (basically, inside the webplayer's window, but I assume the solution would be the same).

The reason I think it should be possible is because it's also possible to lock the co-ordinates of the mouse to Screen.width/2,Screen.height/2.

Before you tell me to 'just lock the position and use a custom cursor texture that's locked inside the specified Rect', I've tried exactly that, and it does work. And sure, instead of using the mouseposition for things in game you cast a ray from the texture's position, etc. But you can no longer interact with the GUI buttons, which is a dealbreaker.

So if anyone would have any suggestions I'd be very, very, very thankful! I hope I was clear enough in explaining it.


Well, guess I'll make this a bounty then, since I'm really curious to see if this is somehow possible. :)

It's not possible with the current API alone, LockCursor has very limited use there

It is however possible with a native plugin, but for that you're going to need unity pro and some c++/c/objc knowledge, depending on platform, as well as platform specific API knowledge