Search Unity

LoadSceneAsync progress does not work Unity 2018.2. Broken?

Discussion in 'Scripting' started by AkhmedAbasov, Jan 12, 2019.

  1. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    My code:

    Code (CSharp):
    1.  
    2. private IEnumerator LoadMainScene()
    3.     {
    4.  
    5.         AsyncOperation async = SceneManager.LoadSceneAsync(1);
    6.         async.allowSceneActivation = true;
    7.  
    8.         while (!async.isDone)
    9.         {
    10.             float progress = async.progress / 0.9f;
    11.  
    12.             MUIManager.instance.LoadScreenProgressBar.value = progress;
    13.  
    14.             MUIManager.instance.LoadScreenPercentText.text = (progress * 100).ToString();
    15.             yield return null;
    16.         }
    17.  
    18.  
    19.     }
    20.  
    The scene is very big, but there is no smooth loading. Async.progress return 0, 0.9 and then immediately 1.
    Visually it turns out to see only 0 and 100. No smooth loading progress bar. Am I doing something wrong or is it broken?
     
    ghostitos likes this.
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    It's a known issue and has been discussed quite often in the forum.

    Scene Async Load Is Not Async
    https://issuetracker.unity3d.com/issues/async-load-is-not-async

    SceneManager.LoadSceneAsync freezes the editor when loading scenes with a lot of GameObjects
    https://issuetracker.unity3d.com/is...-the-loading-scenes-with-a-lot-of-gameobjects

    Some developers, who have access to Unity's engine source code, were able to make changes that allowed them to fix/workaround this issue, like Playdead for example.
     
  3. AkhmedAbasov

    AkhmedAbasov

    Joined:
    Mar 13, 2014
    Posts:
    163
    So I can't even get smooth download progress? I put up with the freezing scene. I wanted at least the progress of loading the scene (
     
    ghostitos likes this.
  4. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    2019 and still loading bar doesnt go smooth? goes from 0 to full
     
  5. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Are you testing in the editor?
     
  6. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    Yes
     
  7. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
  8. juliens137

    juliens137

    Joined:
    Oct 2, 2017
    Posts:
    26
    I'm getting issues with this in 2018.4.9f1 still in 2020. The progress stays at 0 forever and isDone is true immediately. Any fixes for this or is it working in new versions?
     
  9. artemio_morales

    artemio_morales

    Joined:
    Nov 29, 2015
    Posts:
    19
    Hey all, was running into a stuttering progress bar with my builds on mobile, and figured out the problem.

    At least for me, it turns out that the problem had to do with audio clips. Audio clips that are flagged to 'Decompress on Load', when being loaded asynchronously with a scene, not only take a long time to load, they also cause problems with the operation's progress property.

    The fix was changing all of my audio clips to 'Compressed in Memory'. It fixed my loading bar problems, and also took my scene loading time from 15-23 seconds to about 3 seconds.

    Hopefully this helps someone!
     
    Kobapon likes this.