Search Unity

Which function generates 'AssetBundle was already unloaded' error message?

Discussion in 'Asset Bundles' started by andrew_pearce_, Aug 30, 2021.

  1. andrew_pearce_

    andrew_pearce_

    Joined:
    Nov 5, 2018
    Posts:
    136
    Hello,

    Today I accidently managed to generate "AssetBundle 'path/bundle/name' was already unloaded." error message. There is no information which function generates it or on which line. So I did some experiments, if I am unloading unloaded bundle, I am getting different error. Also, since loading is done in coroutines, the only way to debug the line which causes seems to add Debug.Log() to all places.

    We narrowed issue to the following: the assets gets started to load "bundle.LoadAssetAsync<T>(assetName)" (log message), then the object holding asset manager script gets destroyed by scene change, so OnDestroy methods we start unloading all assets and loaded bundles. The bundle gets unloaded "bundle.Unload(true);" (log message) and then given error message appears, right before LoadAssetAsync is complete (log message) with null asset (as expected).

    I guess that the bundle gets unloaded in the middle of asset loading which causes that error message. However, this is just a guess and I am not sure which function could generate that error message.

    Any suggestion is highly appreciated!

    Andrew
     
  2. andrew_pearce_

    andrew_pearce_

    Joined:
    Nov 5, 2018
    Posts:
    136
    We checked the older version of app which was working fine and it also has this issue (which we never saw before). We guess, it's all should be because of Unity 2018.36 upgrade from 2018.28. Either Unity changed the way assets are loaded and unloaded or this error was not issued. We will try to downgrade project to 2018.28 to confirm or decline our hypothesis.
     
unityunity