How to force Unity not to skip frames?

Hello there,

I have the problem that sometimes, Unity skips some frames, seemingly when its framerate drops too low.
In such situations, the frame count I display goes like this: 300, 301, 302, 307, 308, 311, 312, etc.

So, it does not skip calling the Update() function in which I count the frames, but not every frame is visually rendered. Unfortunately, I need each single frame to be visible to be able to capture a video with a selfmade plugin. And if frames 303-306 in the video all display frame 302 and then suddenly jump to 307, it looks very weird.

I really wouldn’t mind the if the frames that would be skipped would instead take twice as long to render. But skipping a frame is something that absolutely must not happen in our application while capturing a video.

Sure I could turn the framerate down manually, to guarantee that each frame has enough time, but that would defeat the purpose of being able to render as fast as possible. Instead, having the application render at around 170 fps normally and for some frames dropping to 40 fps or so would be no problem.

Maybe Time.captureFramerate is what you need. Here you can find an example of script for that function. “This is useful if you want to capture a movie where you need a constant frame rate” (from the documentation).