- Home /
Yield (frames) VS Time.frameCount?
Is there a difference in using yield(frames) in a while(true) Vs using Time.frameCount to limit code iterations?
The while(true) makes a continous loop. So these seem similar. Ive been using while(true) method, but it would'nt be hard to switch it if the other method is safer or better, etc.
Yeah, I am talking about frames. And not just until next frame, but many frames.
Would yield return null with a frame counter be better than doing yield(frames)? Or is it also the same?
yield(frames) is the same than yield null in javascript if i'm right, you can't tell him to yield for x number of frames... but I could be wrong I'm no expert in javascript
And yield(frames) in C# would just not compile...
So would will need to keep a frame counter
Ok, so is this frame counter still appropriate in a fixed update? Like, if I want different fixed update scripts to run at different speeds than my fixed time step? Thanks for your help, please convert your initial comment to an answer so i can accept!
Answer by PouletFrit · Jun 15, 2014 at 05:50 PM
yield return null, stop it's process until next frame, as Time.frameCount keeps track of the total frame passed since the start, either way you would need to add a variable to keep track of the number of frame passed, so no there is no difference, but if you were talking about yield return new WaitForSeconds(), yes there is, since it's time base and not frame base...