Does anyone know if it’s possible to get the Graphics FPS/ms values as shown in the Rendering Statistics window? I have tried implementing at least 5 different variations of an FPS counter via Unity forums and other websites, including my own perversions, but none of them come close to the accuracy shown by the Rendering Statistics window.
This window trying to guess FPS in resulting build, without the editor overhead. I’m afraid it is too hard to replicate that. But you don’t need it since in the editor you can check stats window and in the build theres no editor overhead, so 1/Time.deltaTime is your actual fps. If you want more informative counter, I suggest you check this tutorial https://catlikecoding.com/unity/tutorials/frames-per-second/
Have you tried Graphy?
This ^^^
1/Time.deltaTime should be your FPS for that frame. If you want you could do a little math to average it out over several frames to have a more stable counter.
Thanks for the info everyone! I should have mentioned I’m already using the 1/deltaTime calculation, but it’s always about half of what Unity stats shows. I also tried Graphy, it shows the same as 1/deltaTime, just in a pretty format.
It’s must be editor overhead. Check the profiler view.
Thanks for clearing that up been spending pointless hrs to fig this out and getting confused. Should have just googled to come to this thread.
My code for tracking updates and fps if anyone finds it useful :
float updateCount = 0;
float fixedUpdateCount = 0;
float updateUpdateCountPerSecond = 0;
float updateFixedUpdateCountPerSecond = 0;
float FPS = 0;
// Increase the number of calls to Update.
void Update()
{
if(isDebug)
updateCount += 1;
}
// Increase the number of calls to FixedUpdate.
void FixedUpdate()
{
if(isDebug)
{
fixedUpdateCount += 1;
pointInstance = dynamicEventInfo.PointerDynamicInputEventUpdate();
}
}
// Accumulate frames every second.
IEnumerator FPSTracker()
{
while (true)
{
yield return new WaitForSeconds(1.0f);
updateUpdateCountPerSecond = updateCount;
updateFixedUpdateCountPerSecond = fixedUpdateCount;
FPS = 1/Time.deltaTime;
updateCount = 0;
fixedUpdateCount = 0;
}
}