Time.frameCount since scene load?

Time.frameCount counts the total number of frames since the game has started.

Is there a built in way of knowing the frameCount since the scene was loaded, meaning that when I reload the same scene that value should start at 0.

Just keep track yourself.

private int counter = 0;
void Awake() {
counter = 0;
}
void Update() {
counter++;
}
2 Likes

Alternatively, if you don’t need it every frame, just store it once at scene load and do the math when you need it:

int frameCountAtSceneStart = 0;

void Start() {
  frameCountAtSceneStart = Time.frameCount;
}

int framesSinceSceneLoad => Time.frameCount - frameCountAtSceneStart;
2 Likes