Note that there are some explanatory texts on larger screens.

plurals
  1. POConstant and probably inaccurate Frame Rate
    primarykey
    data
    text
    <p>I am using the following code to calculate Frame Rate in Unity3d 4.0. It's applied on a NGUI label.</p> <pre><code>void Update () { timeleft -= Time.deltaTime; accum += Time.timeScale/Time.deltaTime; ++frames; // Interval ended - update GUI text and start new interval if( timeleft &lt;= 0.0 ) { // display two fractional digits (f2 format) float fps = accum/frames; string format = System.String.Format("{0:F2} FPS",fps); FPSLabel.text = format; timeleft = updateInterval; accum = 0.0F; frames = 0; } } </code></pre> <p>It was working previously, or at least seemed to be working.Then I was having some problem with physics, so I changed the fixed timestep to 0.005 and the Max timestep to 0.017 . Yeah I know it's too low, but my game is working fine on that.<br> Now the problem is the above FPS code returns 58.82 all the time. I've checked on separate devices (Android). It just doesn't budge. I thought it might be correct, but when I saw profiler, I can clearly see ups and downs there. So obviously it's something fishy. </p> <p>Am I doing something wrong? I copied the code from somewhere (must be from the script wiki). Is there any other way to know the correct FPS?</p> <p>By taking cues from <a href="http://answers.unity3d.com/questions/64331/accurate-frames-per-second-count.html" rel="nofollow">this questions</a>, I've tried all methods in the first answer. Even the following code is returning a constant 58.82 FPS. It's happening in the android device only. In the editor I can see fps difference.</p> <p><code>float fps = 1.0f/Time.deltaTime</code>;</p> <p>So I checked the value of Time.deltaTime and it's 0.017 constant in the device. How can this be possible :-/</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload