Search Unity

LoadSceneAsync makes the game stutter, even with lowest background thread priority!

Discussion in 'Editor & General Support' started by TruffelsAndOranges, Jan 29, 2016.

  1. TruffelsAndOranges

    TruffelsAndOranges

    Joined:
    Nov 9, 2014
    Posts:
    92
    I'm using the following calls to load a scene:

    Code (CSharp):
    1. Application.backgroundLoadingPriority = ThreadPriority.Low;
    2. loadingOperation = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneNameToQueue, LoadSceneMode.Additive);
    3. loadingOperation.allowSceneActivation = true;
    When I do that call, the game stutters. The scene then loads and activates. If the game stutters using that call, then the whole point of async loading is lost.

    Anyone have any idea what the problem could be? I preload the shaders using shader variants. The stutter happens when I preload one of my scenes that has alot of textures. Could that be it? Is there any way to async preload resources in a given scene so that I don't have to "stutter" when I load the scene? Manually loading from different "Resource" paths doesn't seem like a good idea...
     
    Last edited: Jan 29, 2016
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
  3. TruffelsAndOranges

    TruffelsAndOranges

    Joined:
    Nov 9, 2014
    Posts:
    92
  4. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    3,276
    Not all the steps that need to be done when you call LoadSceneAsync are possible to execute in a separate thread.
    Some of the stuff needs to be done in the main thread and that might be stuttering.
    One example is the start / awake function of your new scene, if its complicated it will eat up quite some time.