- Home /
Is it possible to get the value of waitForTargetFPS?
Hi there,
I was trying to don't waste CPU at each frame, so I was thinking to watch the value of waitForTargetFPS until it gets close to 0% to know if I can continue using the CPU in that frame. Or is there another way to do that?
thank you in advance
rp
Answer by Eric5h5 · Apr 01, 2013 at 10:49 PM
WaitForTargetFPS is not anything that's available in scripting, but it's not necessary and you don't need to do anything. It sounds like you have vsync on, so Unity doesn't do anything but wait until it's able to draw the next frame anyway.
Ok, but there is a way to know if I can continue using the CPU to compute some data before to pass to the next frame so I can still getting 60 fps?
Why would you want to do that? Be happy that your scripts are fast/simple enought that they work fine. If you want to calculate other things just do it. Write a sudoku solver in a coroutine which Unity can play with until the frame is done, if you fear Unity can be bored to much.
Actually this would be quite useful to have from scripting because when you have VSync on, there's no way to actually measure how much room you still have (except if you use the profiler, of course).
Well it seems I didn't understand the question at the point writing the comment. To answer the question for possible alternatives: $$anonymous$$ultithreading. I think that this a use-case for that.
Your answer
![](https://koobas.hobune.stream/wayback/20220613095224im_/https://answers.unity.com/themes/thub/images/avi.jpg)