This asset provides a simple api to lock the cursor in place, unlike the available Unity api which will re-center the cursor.
It also provides a cross-platform (Windows, MacOS and Linux) api to Set and Get the absolute cursor position. The windows implementation also has a direct API to lock the cursor to a specific rectangle/area (linux/macos have no such thing).
Provided API:
* bool LockCursorInPlace.Locked
* Vector2 CursorPosition.Get()
* CursorPosition.Set(Vector2)
* CursorPosition.ConfineToRect(Vector2 topLeft, Vector2 bottomRight)
This asset is compatible with Windows, Linux (X11 only at this time), and MacOSX (up to 10.4 Mojave, see below) and it has been tested on Unity Versions 2017.4 LTS up to 2018.3. It should work on any unity version though, since it uses no special features.
WARNING: From macOs 10.14 Mojave apple has restriced the os api that is used to move the mouse cursor around, it is supposed to require permissions (see https://bugreports.qt.io/browse/QTBUG-68830), but there is also reports of it simple not working at all.