Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Why is Input.Mouseposition lagging behind the hardware cursor?

Discussion in 'Input System' started by Xcrypt1991, Nov 22, 2020.

  1. Xcrypt1991


    May 20, 2020
    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?
    Last edited: Nov 23, 2020
    CloudyVR likes this.
  2. MaximPP


    Jan 26, 2019
    same problem Unity 2019.4
    CloudyVR likes this.
  3. Thygrrr


    Sep 23, 2013
    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.
    CloudyVR likes this.