Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

SceneManager.LoadSceneAsync skips from 0 to 0.9

Discussion in 'Scripting' started by Hazneliel, Mar 10, 2018.

  1. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    308
    Im loading a scene asynchronously with the following code:

    Code (CSharp):
    1.        
    2.         AsyncOperation asyncOperation = SceneManager.LoadSceneAsync(levelName);
    3.         asyncOperation.allowSceneActivation = false;
    4.  
    5.         while (!asyncOperation.isDone) {
    6.             Debug.Log("Progress: " + asyncOperation.progress);
    7.  
    8.             if (asyncOperation.progress >= 0.9F) {
    9.                 if (Input.GetKeyDown(KeyCode.F)) {
    10.                     asyncOperation.allowSceneActivation = true;
    11.                 }
    12.             }
    13.             yield return null;
    14.         }
    15.  
    And this is what is printed:
    Progress: 0
    Progress: 0.9

    So it is skipping from 0 to 90%

    Why is this happening?

    Thanks in advance for any help
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,201
    Without knowing more specifics, it just sounds like the scene is loading extremely quickly, and halting at 0.9 per the documentation: