Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Fixed in 2018.2.20f1: Asset Bundle and memory

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

  1. nepoez

    nepoez

    Joined:
    Sep 11, 2011
    Posts:
    277
    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. nepoez

    nepoez

    Joined:
    Sep 11, 2011
    Posts:
    277
    This seems fixed in Unity
    2018.2.20f1
     
    Last edited: Jan 15, 2019 at 12:36 PM