Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

ClearDependencyCacheAsync AssetBundle is still in use

Discussion in 'Addressables' started by Redtail87, Jan 17, 2020.

  1. Redtail87

    Redtail87

    Joined:
    Jul 17, 2013
    Posts:
    124
    I'm trying to delete the cached asset bundles for a given asset using ClearDependencyCacheAsync.
    It works fine if the bundles were never loaded in the session, but if they were, I can't seem to figure out how to fully unload them to be able to delete them. I get the warning: "AssetBundle "bundle.name" with hash "hash#" is still in use.

    For my tests, I just download the dependencies for an asset, but never use it, then use Addressables.Release on the operation handles and the resource locator, is there something else I need to do?

    Also, using AssetBundles.GetAllLoadedAssetBundles() returns 0 items.

    Thanks.
     
  2. pontos_developer

    pontos_developer

    Joined:
    May 20, 2020
    Posts:
    15
    I have same problem like this.
    Is it been solved?
    I tried
    Resources.UnloadUnusedAssets---->No use.
    and not really good method,
    find the path and Use System.IO to delete the folder but there had the lock file I cant delete it.
    and try LoadAsset again the unity will crash.
    --------------------Update
    I found some solution but still not work completely.
    I call the AssetBundle.UnloadAllAssetBundles(true);

    then Clear bundle again.
    Okay It works! but I Cant LoadAsset instead....

    Unable to load dependent bundle from location
    The same problem in here
    https://forum.unity.com/threads/unable-to-load-dependent-bundle-from-location.792813/

    Didn't fix this until now?:(

    Is there has any solution?
    Hope that! thank you.
     
    Last edited: Dec 23, 2020
  3. Carocrazy132

    Carocrazy132

    Joined:
    Aug 16, 2015
    Posts:
    15
    Had this issue today
    AssetReference.ReleaseAsset() is the function you need to run before running ClearDependencyCacheAsync()
     
    AbgaryanFX likes this.