Question to WaitForEndOfFrame
Let's take a look at the explanation of waitforendofframe http://docs.unity3d.com/ScriptReference/WaitForEndOfFrame.html.
In this example a png will generate after yield waitendoframe.
Can i be sure, that all code that is displayed after
yield return new WaitForEndOfFrame();
will managed and performed befor starting a new gameloop ist startet? (fixed update ...) And if not, how can i do this?
Answer by Jason-H · Jan 26, 2016 at 10:15 PM
Take a look at this infographic describing the route your MonoBehaviour will take: http://forum.unity3d.com/attachments/unity-lifetime-png.47614/
This graphic shows that the WaitForEndOfFrame call will be the very last thing to happen (as long as it didn't get destroyed or disabled). So you can be sure that this will happen before your next Update cycle. However your question has mentioned FixedUpdate which runs at a different rate to Update. FixedUpdate should only be used for physics calculations and rigid bodies. If you are not calculating things with rigid bodies then it would be better to use Update instead.
Answer by tdneren2 · Feb 16, 2018 at 12:07 AM
Ok @Jason-H ... but does it matter if WaitForEndOfFrame is called at the top or at the end of the IEnumerator function? (how will code be executed in the meantime if in top (excactly) - seems like the "Wait" semantic still is quite blurry ... it says "Wait" [if put in top] but still it allows 'another thread/some thread' to continue executing until the EndofFrame?)