- Home /
FrameTiming class not working?
Not sure what I'm doing wrong or this is a bug, but the FrameTiming Class doesnt not seem to work, because it is returning 0 for both cpu and gpu frametime.
FrameTiming ft = new FrameTiming()
Update(){
print(ft.cpuFrameTime); //returns 0
print(ft.gpuFrameTime); //returns 0
}
The documentation doesn't really say much on how to get it to work. Any idea on why it's not working, or what I'm doing wrong?
Answer by GambaDeveloper · Sep 16, 2020 at 12:17 AM
It's supposed to work with FrameTimingManager.CaptureFrameTimings();
and then FrameTimingManager.GetLatestTimings(amountOfCaptures, frameTimings);
where frameTimings is an array you create of FrameTiming (structs actually), and then it would fill that array for you, then all you have to do is get the cpuFrameTime and gpuFrameTime values from an element of your array.
As it is shown in the Dynamic Resolution documentation.
However... I can't actually get it working either, I saw that you have to set true "Enable Frame Timing Stats" on ProjectSettings -> Player -> Other Settings, and I did but the result is 0 ms aswell.. doesn't work in windows Build either, so idk about that..
Your answer
Follow this Question
Related Questions
Is it possible to move time per rendered frame? 0 Answers
Frame Rate acting weird. Performance issue? Mobile 2d game 0 Answers
Framerate counter 1 Answer
How to force Unity not to skip frames? 1 Answer
Getting Input every few frames? 2 Answers