Search Unity

  1. Click here to receive a gift with your purchase of Unity Pro or Unity Enterprise.
    Dismiss Notice
  2. 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

Scene loading best practicies?

Discussion in 'Addressables' started by Kolyasisan, Jun 28, 2020.

  1. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    325
    Recently profiling our project we've noticed a certain behaviour with how addressables load scenes. Specifically, how Unity loads and activates the scenes, which is usually load all of the scenes that are already scheduled via Addressables.LoadSceneAsync() and only then activate them one by one. There's not a single time when the profiler showed both the main thread busy with scene activation and the PreloadManager to be busy with loading.

    I wanted to ask if this is a normal behaviour. If not, then how can we mitigate it?
     
    Adrien_Danglard likes this.
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    686
    I'll forward this over to the team for them to take a look, and share any guidance they kick my way.
     
  3. unity_bill

    unity_bill

    Unity Technologies

    Joined:
    Apr 11, 2017
    Posts:
    1,026

    Unfortunately, that is the nature of how the engine loads scenes, and has for a very long time. In addition to the threading limitations you mention, it's worth also noting that if you use allowSceneActivation=false, you cannot pre-load multiple scenes. As noted in the engine docs here https://docs.unity3d.com/ScriptReference/AsyncOperation-allowSceneActivation.html, if scene activation is off, the first scene to get to the ready-state will block the async operation queue.

    We have explored changing that engine behavior, but it's a bit outside the scope of our team, and difficult to do given that a lot of existing games & devs rely on that current behavior.

    -Bill
     
    Kolyasisan likes this.
unityunity