Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Initial load of a scene is very slow, seems related to disk access

Discussion in '5.4 Beta' started by kierand, Apr 25, 2016.

  1. kierand

    kierand

    Joined:
    Sep 22, 2014
    Posts:
    32
    This has been submitted as a bug. Case #791537.

    We have noticed that the first time any given scene is loaded, it is very slow.

    Note we use UnityEngine.SceneManagement.SceneManager.LoadSceneAsync to load our scenes.

    We see this in both editor and in a built player (both PC and console platforms). In the case of the editor it will be seen after a computer boot or after a hibernate. In a built player it will be the first time the scene is ever loaded. After that point, even after rebooting the device, the issue will not happen again.

    We have noticed that when it does this long load, a lot (if not all) assets in the game are being read. There are some screen shots attached to the bug that show two instances of this.

    Is there a way around this? If there is a one time thing that needs to be done for each scene, is there a way to trigger this at a time of our choice? For instance, it would be preferable to trigger this on the initial boot of the game for all scenes so that from that point on, the user experience is good.
     
  2. Alex-Lian

    Alex-Lian

    Guest

  3. kierand

    kierand

    Joined:
    Sep 22, 2014
    Posts:
    32
    Hi Alex,

    That is incorrect. The 2 images that you see that in are the good, fast loads in.

    Also we are using WarmupAllShaders.

    It's the other 2 images that show the first time in where you can see the first page of many pages of disk activity on project files.

    Thanks,
    Kieran
     
  4. Alex-Lian

    Alex-Lian

    Guest

    Ah, my misunderstanding. It seems likely related as it's relying on the shader cache for the seeming subsequent runs. So there's some initial processing going on in the first passes. Will pass along to gfx folk to comment.
     
  5. kierand

    kierand

    Joined:
    Sep 22, 2014
    Posts:
    32
    Regardless, the amount it is doing in the subsequent runs is not an issue performance wise. While it would be nice to get rid of that, I'm not too worried about it.

    If you look at the other image and the different files that are being read, it's page after page of assets from the game. I think possibly every asset for the given scene. There must be something that means that it does not need to do this when loading the scene again meaning we don't see any of them when loading back into the scene.

    The strange thing is that in a packaged build, you will not get this initial hit on a fresh boot into the title if you have been into that scene before. It would make more sense in my head if it happened every time you go into a new scene on a fresh boot, but it obviously caches something, somewhere which means that it does not need to do this.

    Now if we knew how to trigger this caching for all scenes, an acceptable solution would be to trigger this on the very initial boot of the title. This would mean that by the time the user gets to the front end, they would never see one of these long loads for any scene.