Search Unity

Question AssetBundle.Unload error

Discussion in 'Asset Bundles' started by Hasxia, Jan 17, 2023.

  1. Hasxia

    Hasxia

    Joined:
    Mar 9, 2021
    Posts:
    7
    In bugly have same error logs:

    # UnityLogError
    AssetBundle.Unload could not complete because the asset bundle still has an async load operation in progress.


    Code (CSharp):
    1. if (assetBundleCreateRequest != null && !assetBundleCreateRequest.isDone)
    2. {
    3.       assetBundleCreateRequest.assetBundle?.Unload(true);
    4. }
    Anyone can give some helpful information, Thanks.
     
  2. AndrewSkow

    AndrewSkow

    Unity Technologies

    Joined:
    Nov 17, 2020
    Posts:
    91
    It seems there is still an Asset load operation that is not complete, e.g. there has been a call to AssetBundle.LoadAssetAsync that has not finished yet.
     
  3. Hasxia

    Hasxia

    Joined:
    Mar 9, 2021
    Posts:
    7
    Thanks @AndrewSkow , can i just call
    Code (CSharp):
    1.  
    2. # Note that accessing asset before isDone is true will stall the loading process.
    3. assetBundleRequest.asset
    4.  
    to force "async" to "sync" before unload asset bundle. And has any methods to cancel async load asset from bundle?
     
    epernigo likes this.
  4. AndrewSkow

    AndrewSkow

    Unity Technologies

    Joined:
    Nov 17, 2020
    Posts:
    91
    Unfortunately there are no methods to cancel an Async Load Asset.