Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

How to detect Unity Lag?

Discussion in 'Editor & General Support' started by Ravel, May 1, 2018.

  1. Ravel

    Ravel

    Joined:
    Nov 21, 2010
    Posts:
    599
    It is clear now that Unity tends to have a unique lag, as if the graphics engine runs separate from everything else. I suppose its something to do with optimization. But it causes some issues when trying to do realtime simulations.

    Basically in my case, when I use deltaTime and when Unity freezes for a couple of ms, the frame is paused but the calclulations keep on running, so after Unity has recovered, you get a physics explosion, as the calculated frame is way ahead from the last frame that Unity was able to render.

    To put things to simple manner, Imagine racing a car, suddenly unity freezes for 0.3 ms and when it returns, the car explodes to the sky.

    If I could detect the frame lag, then I could apply a update limiter, to disable updating while at lag state.

    Thanks in advance!
     
unityunity