Jump to content

Getting around the black screen on WaveSDK-2.1.0 on Unity 2018.2.x


atonalfreerider

Recommended Posts

In case it hasn't been addressed here before, the black screen that appears on first load that is only dismissable by pausing the application (by removing the headset and putting it back on), can be automatically cleared by forcing the application to pause and unpause on first load.

 

Doing a forced pause and unpause requries a modification to the WaveSDK code in WaveVR_Render in OnApplicationPause():

 

    void OnApplicationPause(bool pauseStatus)    {        Pause(pauseStatus);    }    public void Pause(bool pauseStatus)    {        Log.d(LOG_TAG, "Pause(" + pauseStatus + ")");        if (pauseStatus)        {            WaveVR_Utils.IssueEngineEvent(WaveVR_Utils.EngineEventID.UNITY_APPLICATION_PAUSE);            if (synchronizer != null)                synchronizer.sync();            lefteye.getCamera().targetTexture = null;            righteye.getCamera().targetTexture = null;            textureManager.ReleaseTexturePools();        }        else        {            WaveVR_Utils.IssueEngineEvent(WaveVR_Utils.EngineEventID.UNITY_APPLICATION_RESUME);        }        setLoadingCanvas(true);        enableRenderLoop(!pauseStatus);    }

Pause can then be called externally, ideally from a coroutine or a late update with a small delay to allow for the WaveSDK assets to load. The pause and unpause in the renderloop is inperceptible to the user.

 

This is a hack and will hopefully be addressed in a future release.

Link to comment
Share on other sites

  • 2 weeks later...

Actually, for some reasons, it worked (or I thought it worked) the first time, and then not anymore. I tried everything I possibly could.

 

Could you please explain how the Pause method is intended to be used? I tried to call Pause(false) 3 seconds after my player OnEnable. No luck.

Did you change the Scripts Execution Order like recommended in the "documentation"?

Do you need to keep a WaveVR_Init (from [WaveVR] prefab) in the scene?

 

This has been driving me nut for a few days now... Your help would be much appreciated!

Link to comment
Share on other sites

I think the idea is that you first pause and then unpause. Doing it in LateUpdate wasn't late enough for me though. I ended up getting the first frame, but there was no positional tracking or anything else. It seemed like the first frame was just constantly rendered (with a bit of flickering). If I delay it by 1 second in a coroutine, then it works. I just attached this to the WaveVR camera object:

 

using System.Collections;using UnityEngine;public class PauseUnpauseWaveVR : MonoBehaviour {    private void OnEnable()    {        StartCoroutine(ForceWVRPause());    }    private IEnumerator ForceWVRPause()    {        yield return new WaitForSecondsRealtime(1f);        var wvrRender = GetComponent<WaveVR_Render>();        wvrRender.Pause(true);        wvrRender.Pause(false);        Destroy(this);    }}
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...