Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

AssetBundle.UnloadAllAssetBundles() doesn't unload scene bundles

Discussion in 'Asset Bundles' started by PW_Dave, Jan 17, 2019.

  1. PW_Dave

    PW_Dave

    Joined:
    Feb 9, 2017
    Posts:
    19
    I've been doing some testing of the AssetBundle system in order to formulate a plan to support variants with our asset management system. I have a custom editor that exposes most of the raw functionality of the AssetBundle system and I've discovered that AssetBundle.UnloadAllAssetBundles() does not unload scene bundles. Which is kind of annoying.

    My custom editor works fine when I use it to load/unload bundles and I can keep track of everything. But when I open the window during a play session or after closing/recompiling, any scene bundles that are loaded are effectively inaccessible. Due to the following issue (where AssetBundle.GetAllLoadedAssetBundles() doesn't return scene bundles): https://forum.unity.com/threads/ass...etbundles-not-returning-scene-bundles.503657/ , I can't get a reference to the loaded scene bundle. It's basically orphaned and stuck in memory. I have to restart Unity to fix it.

    I'm using Unity 2018.2, in case it's been fixed since then.
     
    unity_QzmvR2WrBsSXAw likes this.
  2. PW_Dave

    PW_Dave

    Joined:
    Feb 9, 2017
    Posts:
    19
    After further work, it turns out that I just need to enter/exit play mode to workaround this issue. Apparently, exiting play mode unloads all bundles including scene bundles. Still, it would be nice to have this fixed.