Mouse.current.WarpCursorPosition misbehaving

I am using the new InputSystem and everything is already set. I can handle input events all good buuuut…

I added a simple script to my scene to keep the mouse in a fixed position:

void Update()
{
    Mouse.current.WarpCursorPosition(Vector2.zero);
}

I couldn’t attach my screenshot of the Input Debugger for the mouse position, it said it couldn’t be parsed for some reason.
But for everyone surprises, the position values where not x=0 and y=0.


So, Mouse.current.WarpCursorPosition is not acting as it should, because mouse is not getting fixed at 0x0 but it is being fixed at position x=-5x and y=756.


I did made a build and it works perfectly, it’s an Editor Play mode only.


What is happening? I can’t keep programming my game if I have to make a build every single time I want to test something just because the code doesn’t work on the editor.


I was using ** Unity v2019.4.31** but I upgraded to the latest stable version at this time the 2021 version and the problem still persists. Same behaviour.

I know that I can compensate this by adding the values until it reaches the desired position, but if I make a single change in my window game size I would have to rewrite this hardcoded fix and I am not looking forward to this.


I am using Debian 11 as my OS. Also tried on Debian 10. Same bug.


Thanks in advance.

I can’t speak for every aspect of this (such as the “-5” x-axis element), but a quick look at this forum thread indicates that a potentially-inverted Y-axis (in builds, not reflected in Editor) was an error with the implementation of Mouse.WarpCursorPosition until Unity version 2020.3.21f1

I upgraded my Toolchain Linux x64 to the latest and now it works.