Game is not rendering in VR headset when on scene view in editor

Hello,

I’m working on a project using Unity Open XR and a Meta Quest2.
I have the following problem, my headset stops displaying the game when I click in the scene view.
To be more precise, if I use a split view, I can navigate between the scene and game window without any troubles.

But if I “Hide” the game view, if I group for example the scene and game windows together, my game stops displaying in my headset but still runs fine in the scene view (the camera is following the headset accordingly, and is still rendering).
I have to precise that this happens only when I switch to the scene window, if I stay on the game window everything runs just fine.

Example : Game runs fine but doesn’t display in VR headset

I am using Open XR 1.11.0 and Unity 2022.3.40, but I tried with different versions of Unity and Open XR with the same result

Is there any way to prevent this from happening or do I need to have the Game window always active and visible in order to display it in the headset?

I’m not familiar with possible restrictions regarding Quest rendering in the editor. But there is a setting or preference to turn on “always render” or “update in background”. One of those could help. Sorry can’t say where exactly in settings these are, probably under Editor or General but could als be in the game view’s toolbar.

So after some research I found two things. First, this problem occurs only when using unity 2022.3.30 or higher. When I looked at the release note for this version, there was a patch on the WaitForEndOfFrame function, that was called once per game view per frame (so twice per frame if you have two game views).

But I think that if you don’t have any game view active, it is never called or something.

I tried it with a simple test code which was as follow.

public int frameCount;
public int frameCount2;

private void Start()
{
    StartCoroutine(EndOfFrameCoroutine());
}

private void Update()
{
    frameCount++;
}

IEnumerator EndOfFrameCoroutine()
{
    Debug.LogWarning("Starting test coroutine");
    while (true)
    {
        Debug.Log("FrameBegin");
        yield return new WaitForEndOfFrame();
        Debug.Log("GamePlaying");
        frameCount2++;
    }
}

When the game runs, both frame counts are incremented, but as soon as I focus on scene view (and then hide the game view), my coroutine stops after the WaitForEndOfFrame instruction.
So I have the feeling that the new behaviour of WaitForEndOfFrame is what cause the issue.

1 Like