- Home /
Question by
dansav · Oct 02, 2012 at 05:08 AM ·
fpsiphoneframes per second
frames per second on iphone
How would I get accurate frames per second on iphone. I tried a few scripts but not sure if they are working correctly since they don't match the fps on the stats page in the editor when running in the editor.
Here's a script that updates a textmesh called text3d.
var updateInterval = 0.5;
private var accum = 0.0; // FPS accumulated over the interval
private var frames = 0; // Frames drawn over the interval
private var timeleft : float; // Left time for current interval
function Start()
{
timeleft = updateInterval;
}
function Update()
{
timeleft -= Time.deltaTime;
accum += Time.timeScale/Time.deltaTime;
++frames;
// Interval ended - update GUI text and start new interval
if( timeleft <= 0.0 )
{
// display two fractional digits (f2 format)
gameObject.GetComponent(TextMesh).text = "" + (accum/frames).ToString("f2");
timeleft = updateInterval;
accum = 0.0;
frames = 0;
}
}
Comment
Best Answer
Answer by Eric5h5 · Oct 02, 2012 at 06:19 AM
That script is correct. The fps in the stats is how long it takes to draw the graphics, not the fps overall.
Your answer
![](https://koobas.hobune.stream/wayback/20220613081742im_/https://answers.unity.com/themes/thub/images/avi.jpg)