Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Why is Input.Mouseposition lagging behind the hardware cursor?

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

  1. Xcrypt1991

    Xcrypt1991

    Joined:
    May 20, 2020
    Posts:
    23
    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

    MaximPP

    Joined:
    Jan 26, 2019
    Posts:
    72
    same problem Unity 2019.4
     
    CloudyVR likes this.
  3. OUTTAHERE

    OUTTAHERE

    Joined:
    Sep 23, 2013
    Posts:
    656
    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.