Search Unity

Question: Asset bundles and memory

Discussion in 'Asset Bundles' started by pintianz, Oct 30, 2018.

  1. pintianz

    pintianz

    Joined:
    Mar 1, 2015
    Posts:
    25
    I'm trying to optimize memory for mobiles game. After reading and trying about asset bundles, I have some questions.
    1. Unused asset still takes up memory at runtime. Why? Shouldn't a image that is not referenced in scene and not in Resources folder not be loaded into memory? Is this a Editor only thing?
    Using memory profiler (https://bitbucket.org/Unity-Technologies/memoryprofiler) and a empty scene. PICTURE (https://imgur.com/mITTNra)
    2. Assetbundle files does NOT taking up memory even though it's also in the Asset folder. Why?
    3. AssetBundle.LoadFromFile does not add any (noticeable) memory footprint. I assume this only load in the manifest file? So is it safe to AssetBundle.LoadFromFile all bundles on scene start as long as no assets are being loaded from the bundles themselves?
    4. For my goal of optimizing runtime memory usage by loading asset just in time. My plan of approach is as follows, please let me know if there are better way of doing things:
    - Build asset bundles from the image assets
    - Delete image assets from asset folder
    - AssetBundle.LoadFromFile all Bundles at scene start
    - Load and unload prefabs when needed
    I really hope I don't have to do step 2. Deleting assets from my project just feels weird.