the documentation about the UnityEngine.Time class states
Time.frameCount: The total number of frames that have passed.
Are these render-frames or physics-frames (FixedUpdates)?
Since the documentation just says frames, it might be render frames, BUT: What’s Time.renderedFrameCount then? It’s not in the docs. Comparing frameCount and renderedFrameCount, I saw that frameCount increases slower than renderedFrameCount, which made me think frameCount could be the physics frames (I have physics framerate set to 50, while the render framerate in my test case was usually higher).
Not affected by Time.timeScale and not related to Physics update.
Increments only once per Unity update before any of the main updates are called, so the value can be the same over multiple frames for loops that can run multiple times per update (FixedUpdate, OnGUI).
Could be thought of as a count of the number of times that Update has run, though technically it’s incremented before Update is called each frame.
– Time.renderedFrameCount
The number of frames rendered.
Not affected by Time.timeScale and not related to Physics update.
Continues to increment when the Play is paused in the editor.
Increments at least once per Unity loop at the beginning of the frame.
–
Some simple logging code (below) shows that Time.renderedFrameCount will rapidly outpace Time.frameCount, always being Time.frameCount * 2 - 1 (the first update frame it’s only incremented once, but then is incremented twice per frame thereafter) in my tests. This is the case whether or not VSync is enabled.
using UnityEngine;
using System.Collections;
public class RenderTest : MonoBehaviour {
void Update() {
Debug.Log("UPDATE: Frame count = " + Time.frameCount + "
Physics update has a separate frame count and can run zero or many times a frame depending on what the physics frame rate is ( and how long your frame actually ran )
@or1on I had the same problem and found the reason for it finally.
See this thread, which quotes the official docs on Execution Order:
… FixedUpdate: FixedUpdate is often called more frequently than Update. It can be called multiple times per frame, if the frame rate is low and it may not be called between frames at all if the frame rate is high…