Why is Input.Mouseposition lagging behind the hardware cursor?

Hello. I have recently made a shocking discovery that the location Input.Mouseposition gives you is lagging behind several pixels compared to the actual hardware cursor (probably 20+px on my 60Hz monitor, whereas maybe 10px on my 144Hz monitor).

I have tried to put this on video but it doesn’t work well. However, you can try it out yourself with my test build.

I have tried enabling/disabling VSync, and setting QualitySettings.maxQueuedFrames to 0 as this post suggests, but nothing seems to make any difference.

As you see in this post, for that user it is working fine when he is getting 2k+ framerate, but for me it makes no difference when I also hit 2-3k framerate.

Does anyone know what is happening here and how I can fix it?

1 Like

same problem Unity 2019.4

1 Like

It’s only one frame, seemingly, but it appears to be an ENTIRE monitor refresh frame, regardless how fast unity runs.

However, if Unity renders at 300 fps, your screen has 60 fps, how can there be a WHOLE 60 fps lag vs. the hardware cursor as if Unity actually doesn’t poll/update the input in these other frames.

1 Like