Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

VR environment is black while LoadSceneAsync

Discussion in 'AR/VR (XR) Discussion' started by adri1992, Oct 13, 2016.

  1. adri1992


    Dec 14, 2015
    I'm trying to load a large scene through *SceneManager.LoadSceneAsync* in a VR project.

    It seems that works fine, because the new scene is loaded after 30 seconds approximately, but I see two problems:

    1. Once the progress of the AsyncOperation object has finished (it takes 1 or 2 seconds to finish), the app seems "frozen" and the user only can see the area that is renderized (if the user move their head in any direction of 360º and try to see a new area, it will be black). I want that the user can see the full environment while the scene is being loading.
    2. The progress duration of the AsyncOperation takes over 2 seconds as I told. After that time, the new scene appears after 30 seconds, so I can't make a real progress bar... Any idea?

    I'm using this code:

    Code (CSharp):
    1.   ...
    2.   StartCoroutine(loadingScene());
    3.   ...
    5.   IEnumerator loadingScene(){
    7.        yield return null;
    9.        AsyncOperation ao = SceneManager.LoadSceneAsync("Scene");
    10.        ao.allowSceneActivation = false;
    12.        while (! ao.isDone)
    13.        {
    14.          float progress = Mathf.Clamp01(ao.progress / 0.9f);
    15.          progressText.text = progress+"";
    16.          if (ao.progress == 0.9f)
    17.          {
    18.            ao.allowSceneActivation = true;
    19.          }
    21.          yield return null;
    22.        }
    23.   }
    Check this image to see that the user see if move their head (first problem mentioned). Only is visible the rectangular area that has been rendered:

    The photo has been taken with a smartphone through the Samsung Gear VR lens.

    Thanks so much