- Home /
FPS + Time.time not accurate on iPhone5
Hi,
I'm fighting with Time.time on iPhone5... I'm displaying the time with the following code:
function Udapte(){
timecount = Time.time - startTime;
min = (timecount/60f); // Get the minutes
sec = (timecount % 60f); // Get the seconds
fraction = ((timecount * 100) %100);
GUI.Box (Rect (10,10,110,50), String.Format(Time.time + '') );
}
However, it goes slower than the real time when I compare it on my watch. I thus decided to monitor the framerate with the following code (from the wiki), as it seems that Time.time is framerate dependant.
function Update()
{
timeleft -= Time.deltaTime;
accum += Time.timeScale/Time.deltaTime;
++frames;
// Interval ended - update GUI text and start new interval
if( timeleft <= 0.0 )
{
displayFPS = accum/frames;
timeleft = updateInterval;
accum = 0.0;
frames = 0;
}
}
No matter what I do, I ALWAYS get 50 fps on my iPhone 5, and it's never changing. On my iPad mini however it's variating around 50. But on iPhone 5 it seems like stuck to 50. It works also fine in the editor, meaning that the fps is variating between 59 and 60. I tried to change VSync, but no matter the value (0,1,2) it stays at 50 fps :/
What should I change to have the real time in seconds displayed and not a time which is slower than the real one) and the right FPS? The timescale is at 1, and it's not changing in game...
You might try this script to see if you get different results: http://wiki.unity3d.com/index.php?title=FramesPerSecond
Answer by NicolasLIATTI · Mar 09, 2013 at 11:56 PM
Hi,
When this is the script I am using. but I finally found the problem, it came from the fixedtimestep in the Time manager that was too low. I put it higher and now everything is normal :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613094119im_/https://answers.unity.com/themes/thub/images/avi.jpg)