- Home /
Stepping through WaitForEndOfFrame when GameView isn't visible
Using that simple code:
IEnumerator EOF () {
yield return null; // wait one frame so that SceneView focuses
yield return new WaitForEndOfFrame (); // steping will hang here unless you focus GameView again
Debug.Log ("Got here!");
}
void OnGUI () {
if (GUILayout.Button ("Test")) {
Debug.Break ();
StartCoroutine (EOF ());
}
}
Using default layout (where Scene and Game are tabbed, so you can't see both at the same time), if I hit Play from the SceneView, and hit the Test button, I'd get to a paused state of the game and my SceneView focused.
If I try to step though my coroutine, I never get passed yield return new WaitForEndOfFrame ();
unless I switch to GameView again.
No matter how many times I hit Step, the game gets paused there. Even the profiler stops reporting (despite frames keep counting).
Is this a bug?
Answer by dithyrambs · Mar 11, 2020 at 03:06 AM
I'm encountering this exact bug, , uh, six years after this was posted. Anyone else?
I was having this exact same bug, then read the documentation for WaitForEndOfFrame:
Switching from the Game view to the Scene view causes WaitForEndOfFrame to freeze.
Well. There you have it. I guess it's a feature, not a bug. ^<^
Your answer
Follow this Question
Related Questions
GameObject won't appear in Game view 2 Answers
ReadPixels to capture GameView in EditMode and "Pixels out of bounds" 3 Answers
Game object is visible in scene tab,but not in the game tab. 17 Answers
strange results with GUI.DrawTexture() in the editor scene 1 Answer
Turn scene view "full screen" off 0 Answers