Search Unity

Fixed in 2018.2.20f1: Asset Bundle and memory

Discussion in 'Asset Bundles' started by NestorAlgieri, Dec 9, 2018.

  1. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    Hi! I was under the impression that an Asset Bundle when loaded, does not take up much memory. It just loads the headers of the assets in side if it which should be minimal memory. It's only when you load the asset that takes up memory.

    I have an asset bundle that has 500 sector scenes in it. It's for a streaming world. It only ever loads 9 sectors at a time via SceneManager.LoadSceneAsync(). When any additional sectors are loaded, the for away ones are always unloaded. This works fine and there's no memory leak. However, when the asset bundle has 3000 sector scenes in it, even though again, only 9 ever gets loaded, on a low end device this will cause a out of memory exception when I load the 9 scenes via SceneManager.LoadSceneAsync(), same 9 scene in the other test case.

    Note that the problem isn't with loading the asset bundle via WWW.LoadFromCacheOrDownload(), this has no problem, the asset bundle is already downloaded and loaded when game starts. It only crashes when SceneManager.LoadSceneAsync() is called, if there are 3000 scenes in the bundle.

    This leads me to believe that even though only 9 scenes out of 3000 scenes are loaded, the other 2991 scenes are using up runtime memory when I load a scene from the asset bundle.

    Can someone who know about this comment on this?

    Also, I have another asset bundle that has couple thousand items in it, these are not scenes though, these are objects like weapons, armor etc, and that has never caused an issue. So it there a difference in how Scene asset bundles and Object asset bundles handle memory?

    Thanks!
     
    Last edited: Dec 9, 2018
  2. NestorAlgieri

    NestorAlgieri

    Joined:
    Sep 11, 2011
    Posts:
    299
    This seems fixed in Unity
    2018.2.20f1
     
    Last edited: Jan 15, 2019