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

Question How to use Addressables.ClearDependencyCacheAsync? where lines?

Discussion in 'Addressables' started by liyangw107, Aug 5, 2020.

  1. liyangw107

    liyangw107

    Joined:
    Aug 27, 2019
    Posts:
    12
    Hello. every one.
    Recently I was interested in addressables and I am developing super simple demo.
    But i have some problems in Cache clearing.
    I am using Unity 2019.4.5f1 and addressable 1.8.4. Also I am testing my demo on windows standalone.

    My develop step is like following.
    1. I created two PackedAsset groups and named them (groupA, groupB).
    - groupA has asset1, asset2, asset3
    - groupB has asset4, asset5
    2. I built addressable assetbundle and upload it to aws s3 bucket.
    3. I run the app and app downloaded all assets (both groupA, groupB)
    4. After that, I modified only asset4 from groupB.
    5. I built addressable assetbundle again and replace old ones with this new ones in aws s3 bucket.
    6. When i run the app, app detects the updated size correctly and download only updates (updates was groupB but not only asset4).
    But problem was app size increasing because of cached size.
    It seems app downloaded groupB bundles again but not replace old groupB bundle.

    so I was thinking Addressables.ClearDependencyCacheAsync(key).
    Code (CSharp):
    1.  
    2. IEnumerator checkUpdate()
    3.  
    4. {
    5.         var initHandle = Addressables.InitializeAsync();
    6.         yield return initHandle;
    7.         var handler = Addressables.CheckForCatalogUpdates(false);
    8.         yield return handler;
    9.  
    10.        if (handler.Status == AsyncOperationStatus.Succeeded)
    11.         {
    12.               var catalogs = handler.Result;
    13.               if (catalogs != null && catalogs.Count > 0)
    14.              {
    15.   Addressables.ClearDependencyCacheAsync(key);
    16.                   var updateHandle = Addressables.UpdateCatalogs(catalogs, false);
    17.                 yield return updateHandle;
    18.              }
    19.       }
    20.      Addressables.Release(handler);
    21. }
    I inserted Addressables.ClearDependencyCacheAsync(key); but I am not sure it is right or not.
    maybe it is not correct.
    Also how can i define key as parameters on that function?
    what can i use for params key.

    I hope ClearDependencyCacheAsync will delete old cached (groupB) and download new groupB.

    Please help me about this.
    Thank you.
     
  2. liyangw107

    liyangw107

    Joined:
    Aug 27, 2019
    Posts:
    12
    :( any news?
     
  3. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
  4. liyangw107

    liyangw107

    Joined:
    Aug 27, 2019
    Posts:
    12
    Hi. inkletom. Thank you for your response...
     
  5. liyangw107

    liyangw107

    Joined:
    Aug 27, 2019
    Posts:
    12
    I have found some idea.
    You need to compare old cache list and new bundles list from updated catalog.
    so you can get lists which caches are old ones from comparation.
    That lists will be bundle names.
    Using Caching.ClearAllCachedVersions(bundlename) , you can clear old bundles you need to clear.
    From my side, this is working great.
    of course, this solution seems like manual way but i think it will be useful for some developers.

    If there will be some problem for this, please feel free to advice me.
    Thank you.
     
  6. Jalict

    Jalict

    Joined:
    Nov 3, 2014
    Posts:
    20
    I just need to confirm what I am reading.
    Caching.ClearAllCachedVersions(bundlename)
    clears all the bundles with the specific Bundle Name / Addressable Groups name?
    Meaning if I have a bundle named
    my_bundle
    , gets build into
    my_bundle_<hash>
    . Does it account for all the ones with different hashes?
     
  7. liyangw107

    liyangw107

    Joined:
    Aug 27, 2019
    Posts:
    12
    upload_2020-8-7_18-3-43.png
    what I mean is this name. maybe "otherpack_assets_all_0f34bb97cbdf95f6c57024202bff5c80"
    when you build addressable bundle, you can see this type files in your ServerData. right?
    For me, it works great.
     
    Last edited: Aug 7, 2020
  8. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    Hi, I couldn't make the
    Caching.ClearAllCachedVersions(bundlename)
    works.
    When I call it nothing happen. Are you pass in the "otherpack" or "otherpack_assets_all_0f34bb97cbdf95f6c57024202bff5c80"
    I'm currently making a Unity apps that contains many minigames and really need the function to remove downloaded game for the storage management feature:confused:.
     
  9. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
    I'm doing the same thing - for now we're just not doing it, in the hope that it gets fixed soon. Is there anyone from Unity who can respond to this please?
     
  10. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    Currently i'm using this for temporary solution on Editor/Standalone Build, haven't test it on mobile yet. Still I guess it'll only work if Addressable is only thing you use as cache since idk what order of Caching.GetAllCachePaths will return

    Code (CSharp):
    1. public static void RemoveGameAsset(string gameID, Action onFinish)
    2.         {
    3.             #region Temporary solution for clearing game
    4.             //This solution assume the Caching.GetAllCachePaths will return a list that have first element is the path that addressable use
    5.             //If not pray and search on Unity forum for better solution;
    6.             Instance.StartCoroutine(Instance.DeleteGame(gameID, result =>
    7.             {
    8.                 List<string> allCachePath = new List<string>();
    9.                 Caching.GetAllCachePaths(allCachePath);
    10.                 string path = allCachePath[0];
    11.                 foreach (var bundle in (List<IAssetBundleResource>)result.Result)
    12.                 {
    13. try{
    14.                     Directory.Delete(path + "/" + bundle.GetAssetBundle().name, true);
    15. }
    16. catch(Exception e){
    17. // This to ignore the fact that _lockfile inside assetbundle cannot be delete
    18. }
    19.                 }
    20.                 onFinish?.Invoke();
    21.             }));
    22.  
    23.             #endregion
    24.         }
    25.  
    26.         IEnumerator DeleteGame(string gameID, Action<AsyncOperationHandle> onFinish)
    27.         {
    28.             var getSizeHandle = Addressables.GetDownloadSizeAsync(gameID);
    29.             while (!getSizeHandle.IsDone)
    30.             {
    31.                 yield return new WaitForEndOfFrame();
    32.             }
    33.             if (getSizeHandle.Result == 0)
    34.             {
    35.                 //Game downloaded process to remove stuff
    36.                 var getAllBundleHandle = Addressables.DownloadDependenciesAsync(gameID);
    37.                 while (!getAllBundleHandle.IsDone)
    38.                 {
    39.                     yield return new WaitForEndOfFrame();
    40.                 }
    41.                 onFinish(getAllBundleHandle);
    42.                 Addressables.Release(getAllBundleHandle);
    43.             }
    44.             else
    45.             {
    46.                 Debug.LogError("Error removing game, game hasn't been downloaded");
    47.             }
    48.         }
    Edit: After running for awhile I notice that Directory.Delete cannot delete folder that not empty and cannot delete _lockfile that generate when using Download to fetch all bundle name. So I add try/catch block to ignore that. Still not test on mobile tho
     
    Last edited: Aug 13, 2020
  11. PascalZieglerAzuryLiving

    PascalZieglerAzuryLiving

    Joined:
    Aug 3, 2020
    Posts:
    11
    Has anybody found a working workaround for the problem yet?
     
  12. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
  13. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    I tried to use the newly added ClearCacheDependancy API using label, group's name, scene's and nothing seem to work. Well at least the API return AsyncOperation now to properly execute event if I can use it someday. PROGRESS!
     
  14. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
    Ah, thanks for testing it. (As an aside, can you use group name as a key!? That's super handy if true)
     
  15. PascalZieglerAzuryLiving

    PascalZieglerAzuryLiving

    Joined:
    Aug 3, 2020
    Posts:
    11
    As far as I understand it when I skipped through the code of the new method ist, that it's just a wrapper around the old method that simply returns true instead of void.
     
  16. PascalZieglerAzuryLiving

    PascalZieglerAzuryLiving

    Joined:
    Aug 3, 2020
    Posts:
    11
    Update:



    I managed to write a workaround. As far as I see it there were not one but two problems in the code.

    1. The Addressables method uses Caching.ClearAllCachedVersions(), which seems to be broken. I fixed it by using the more specific method Caching.ClearCachedVersion();

    2. The Addressables method is using Path.GetFileName(dep.InternalId) instead of the bundle name, which returns the actual hash instead.


    I fixed these two issues by copying all methods necessary into my own fixing class and fixed these two issues there. This is my working code (tested in editor, standalone and oculus Quest (Android) with addresses as well as labels. Also getDownLoadSize won't break like with the workaround mentioned above):




    Code (CSharp):
    1.  public class AddressablesFixes : MonoBehaviour
    2.     {
    3.         /// <summary>
    4.         /// This is a workaround the broken Addressables method. If Addressable Package is updated this method could break, or in the best case become obsolete.
    5.         /// </summary>
    6.         /// <param name="key"></param>
    7.         public static AsyncOperationHandle ClearDependencyCacheForKey(object key)
    8.         {
    9.             AsyncOperationHandle initHandle = Addressables.InitializeAsync();
    10.             if (initHandle.IsDone)
    11.             {
    12.                 ClearDependencyCacheForKeyInternal(key);
    13.             }
    14.             else
    15.             {
    16.                 initHandle.Completed += (handle) =>
    17.                 {
    18.                     ClearDependencyCacheForKeyInternal(key);
    19.                 };
    20.             }
    21.             return initHandle;
    22.         }
    23.  
    24.         private static void ClearDependencyCacheForKeyInternal(object key)
    25.         {
    26. #if ENABLE_CACHING
    27.             IList<IResourceLocation> locations;
    28.             if (key is IResourceLocation resourceLocation && resourceLocation.HasDependencies)
    29.             {
    30.                 foreach (var dep in resourceLocation.Dependencies)
    31.                 {
    32.                     if (dep.Data is AssetBundleRequestOptions options)
    33.                     {
    34.                         ClearCacheForBundle(options.BundleName);
    35.                     }
    36.                 }
    37.             }
    38.             else if (GetResourceLocations(key, typeof(object), out locations))
    39.             {
    40.                 foreach (var dep in GatherDependenciesFromLocations(locations))
    41.                 {
    42.                     if (dep.Data is AssetBundleRequestOptions options)
    43.                     {
    44.                         ClearCacheForBundle(options.BundleName);
    45.                     }
    46.                 }
    47.             }
    48. #endif
    49.         }
    50.  
    51.         private static void ClearCacheForBundle(string bundleName)
    52.         {
    53.             List<Hash128> hashList = new List<Hash128>();
    54.             Caching.GetCachedVersions(bundleName, hashList);
    55.             foreach (Hash128 hash in hashList)
    56.             {
    57.                 Caching.ClearCachedVersion(bundleName, hash);
    58.             }
    59.         }
    60.  
    61.         static private List<IResourceLocation> GatherDependenciesFromLocations(IList<IResourceLocation> locations)
    62.         {
    63.             var locHash = new HashSet<IResourceLocation>();
    64.             foreach (var loc in locations)
    65.             {
    66.                 if (loc.ResourceType == typeof(IAssetBundleResource))
    67.                 {
    68.                     locHash.Add(loc);
    69.                 }
    70.                 if (loc.HasDependencies)
    71.                 {
    72.                     foreach (var dep in loc.Dependencies)
    73.                         if (dep.ResourceType == typeof(IAssetBundleResource))
    74.                             locHash.Add(dep);
    75.                 }
    76.             }
    77.             return new List<IResourceLocation>(locHash);
    78.         }
    79.  
    80.         private static bool GetResourceLocations(object key, Type type, out IList<IResourceLocation> locations)
    81.         {
    82.             key = EvaluateKey(key);
    83.  
    84.             locations = null;
    85.             HashSet<IResourceLocation> current = null;
    86.             foreach (var locatorInfo in Addressables.ResourceLocators)
    87.             {
    88.                 var locator = locatorInfo;
    89.                 IList<IResourceLocation> locs;
    90.                 if (locator.Locate(key, type, out locs))
    91.                 {
    92.                     if (locations == null)
    93.                     {
    94.                         //simple, common case, no allocations
    95.                         locations = locs;
    96.                     }
    97.                     else
    98.                     {
    99.                         //less common, need to merge...
    100.                         if (current == null)
    101.                         {
    102.                             current = new HashSet<IResourceLocation>();
    103.                             foreach (var loc in locations)
    104.                                 current.Add(loc);
    105.                         }
    106.  
    107.                         current.UnionWith(locs);
    108.                     }
    109.                 }
    110.             }
    111.  
    112.             if (current == null)
    113.                 return locations != null;
    114.  
    115.             locations = new List<IResourceLocation>(current);
    116.             return true;
    117.         }
    118.  
    119.         private static object EvaluateKey(object obj)
    120.         {
    121.             if (obj is IKeyEvaluator)
    122.                 return (obj as IKeyEvaluator).RuntimeKey;
    123.             return obj;
    124.         }
    125.     }
    I will file a bug now and post it here. Thanks for the help eveybody. :)
     
  17. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,121
    Nice work, please keep us updated here regarding your bug report!
     
  18. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    @PascalZieglerAzuryLiving
    Thanks for the solution, my solution was kind of wacky and not really reliable since it remove file and directory and ignore all thing else.
     
  19. Tom-EG

    Tom-EG

    Joined:
    Nov 5, 2018
    Posts:
    3
    Last edited: Aug 31, 2020
  20. hazuhiro

    hazuhiro

    Joined:
    Feb 14, 2019
    Posts:
    34
  21. PascalZieglerAzuryLiving

    PascalZieglerAzuryLiving

    Joined:
    Aug 3, 2020
    Posts:
    11
    @hazuhiro I'm not really understanding your question. This solution takes a key and clears all dependencies of it.

    Regarding the bug: It's still open. Will post updates here if that changes. Due to Covid this could take a while I guess.
     
  22. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    566
    I think hazuhiro is asking about how to delete the cached objects that are updated from a catalog update. I believe that is currently impossible, since once you get the new catalog, the old catalog is overwritten, then the references to the old cached objects are lost. Trying to delete the cache from any key thereafter will only delete new bundles. The only way to clear the old bundles, then, is to clear the entire cache.
     
  23. hazuhiro

    hazuhiro

    Joined:
    Feb 14, 2019
    Posts:
    34
    actually i have some workaround for this

    Code (CSharp):
    1. private async void CheckAssets()
    2.     {
    3.         loadingLabel.text = "Checking...";
    4.         IResourceLocator initLocator = await Addressables.InitializeAsync().Task;
    5.         List<string> catalogs = await Addressables.CheckForCatalogUpdates(true).Task;
    6.         if (catalogs.Count > 0)
    7.         {
    8.             List<IResourceLocator> locatorsToUpdate = await Addressables.UpdateCatalogs(catalogs, true).Task;
    9.             foreach (IResourceLocator locator in locatorsToUpdate)
    10.             {
    11.                 downloadSize += await Addressables.GetDownloadSizeAsync(locator.Keys).Task;
    12.             }
    13.             ClearOldBundle(locatorsToUpdate);
    14.             ShowDownloadPopUp();
    15.         }
    16.         else
    17.         {
    18.             downloadSize = await Addressables.GetDownloadSizeAsync(initLocator.Keys).Task;
    19.             if (downloadSize > 0)
    20.             {
    21.                 ShowDownloadPopUp();
    22.             }
    23.             else
    24.             {
    25.                 DoneVerification();
    26.             }
    27.         }
    28.     }
     
  24. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    566
    What is
    ClearOldBundle(locatorsToUpdate);
    doing?

    Also, logically I don't think that works since you have already updated the catalogs before you try to clear the old bundles, unless you somehow hold references to the old bundles before updating the catalogs (which I don't see in your code). Did you actually see that working?
     
  25. hazuhiro

    hazuhiro

    Joined:
    Feb 14, 2019
    Posts:
    34
    Code (CSharp):
    1. private void ClearOldBundle(List<IResourceLocator> _locators)
    2.     {
    3.         foreach (IResourceLocator locator in _locators)
    4.         {
    5.             foreach(object key in locator.Keys)
    6.             {
    7.                 keysToUpdate.Add(key);
    8.                 YOLOAddressables.ClearDependencyCacheForKey(key);
    9.             }
    10.         }
    11.     }
    yeah its work, i already test it and implement it on my game,
    basically
    Code (CSharp):
    1. List<IResourceLocator> locatorsToUpdate = await Addressables.UpdateCatalogs(catalogs, true).Task;
    will return the locator that being updated, i just store it then delete it first before downloading new bundle, and i use @PascalZieglerAzuryLiving method to delete the local storage bundle
     
  26. ProtoTerminator

    ProtoTerminator

    Joined:
    Nov 19, 2013
    Posts:
    566
    Oh interesting. I guess that's because that API only yields the updated assets, not all of them. However, that still leaves the hole of removed assets (which, admittedly, is less common, but no less necessary), right?

    Also, does that work with the
    LoadContentCatalogAsync
    API at app startup?
     
  27. hazuhiro

    hazuhiro

    Joined:
    Feb 14, 2019
    Posts:
    34
    yeah agree, i hope unity team can fix this problem ASAP, because this feature is mandatory i guess.
    i never use "LoadContentCatalogAsync" but i think it will work fine
     
  28. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    Here's the solution I came up with - Our game also downloads all dependencies on startup and we ship a local manifest for the bundles that our game requires. So before downloading new ones (via
    DownloadDependenciesAsync
    ) we clear out any bundle that is not in the manifest:

    Code (CSharp):
    1. private static void ClearBundleCacheAsync(BundleInfo[] bundleInfos) {
    2.     var cachePaths = new List<string>();
    3.     Caching.GetAllCachePaths(cachePaths);
    4.  
    5.     foreach (var path in cachePaths.Where(Directory.Exists).SelectMany(path => Directory.EnumerateFileSystemEntries(path))) {
    6.         var cachedBundleName = Path.GetFileName(path);
    7.         if (!string.IsNullOrEmpty(cachedBundleName)) {
    8.             var cachedBundleVersions = new List<Hash128>();
    9.             Caching.GetCachedVersions(cachedBundleName, cachedBundleVersions);
    10.             foreach (var ver in cachedBundleVersions) {
    11.                 var hash = ver.ToString();
    12.                 if (!bundleInfos.Any(v => v.hash)) {
    13.                     Debug.Log($"Removing cache: {cachedBundleName}:{ver}");
    14.                     Caching.ClearCachedVersion(cachedBundleName, ver);
    15.                 }
    16.             }
    17.         }
    18.     }
    19. }
     
  29. hazuhiro

    hazuhiro

    Joined:
    Feb 14, 2019
    Posts:
    34
    how you generate the manifest?
    do you write it manually?
     
  30. joe_nk

    joe_nk

    Joined:
    Jan 6, 2017
    Posts:
    67
    Nah, we do it as part of the build process, like this:

    Code (CSharp):
    1. private static string AddressableVariableValue(string varName) {
    2.     var aaSettings = AddressableAssetSettingsDefaultObject.Settings;
    3.     var aaProfileId = aaSettings.activeProfileId;
    4.     var aaProfileSettings = aaSettings.profileSettings;
    5.     return aaProfileSettings.EvaluateString(aaProfileId, aaProfileSettings.GetValueByName(aaProfileId, varName));
    6. }
    7.  
    8. private static string BundleName(string fullPath) {
    9.     var fullName = Path.GetFileNameWithoutExtension(fullPath);
    10.     return fullName.Substring(0, fullName.LastIndexOf('_'));
    11. }
    12.  
    13. private static string BundleHash(string fullPath) {
    14.     var fullName = Path.GetFileNameWithoutExtension(fullPath);
    15.     return fullName.Substring(fullName.LastIndexOf('_') + 1);
    16. }
    17.  
    18. private static long BundleSize(string fullPath) {
    19.     return new System.IO.FileInfo(fullPath).Length;
    20. }
    21.  
    22. private static void MakeAssetBundles() {
    23.     AddressableAssetSettings.CleanPlayerContent();
    24.     AddressableAssetSettings.BuildPlayerContent();
    25.  
    26.     var manifest = new Dictionary<string, BundleInfo>();
    27.     var remoteBuildPath = AddressableVariableValue(AddressableAssetSettings.kRemoteBuildPath);
    28.     foreach (var bundle in Directory.GetFiles(remoteBuildPath, kBundleExt)) {
    29.         manifest[BundleName(bundle)] = new BundleInfo {
    30.             hash = BundleHash(bundle),
    31.             size = BundleSize(bundle)
    32.         };
    33.     }
    34.  
    35.     var manifestPath = Path.Combine(Addressables.BuildPath, "manifest.json");
    36.     File.WriteAllText(manifestPath, JsonConvert.SerializeObject(manifest));
    37. }
     
  31. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    Anyone know how to use PascalZieglerAzuryLiving solution right after a addressable bundle has been downloaded. I've been hitting with this
    AssetBundle 'f4a956ccfffbd6e13e7994aa05d4b6e9.bundle' with hash '63302b27afc531f97655f61845b3e12c' is still in use. 

    Are there any API that invalidate the using state of bundle?
    After I reset the app the solution works okey-dokey
     
    Last edited: Sep 14, 2020
  32. tealm

    tealm

    Joined:
    Feb 4, 2014
    Posts:
    108
    This still does not work (Addressables 1.15.1, Unity 2019.4.10f1), tested with a simple
    Addressables.ClearDependencyCacheAsync("key");
    . Did you get any answer on your bug report @PascalZieglerAzuryLiving ? What is the case number? We really need to be able to clear cache, and would hope to avoid making our own custom solution.. I see the call is still using Caching.ClearAllCachedVersions() which you metioned was not working.

    Code (CSharp):
    1. internal void ClearDependencyCacheForKey(object key)
    2.         {
    3. #if ENABLE_CACHING
    4.             IList<IResourceLocation> locations;
    5.             if (key is IResourceLocation && (key as IResourceLocation).HasDependencies)
    6.             {
    7.                 foreach (var dep in (key as IResourceLocation).Dependencies)
    8.                     Caching.ClearAllCachedVersions(Path.GetFileName(dep.InternalId));
    9.             }
    10.             else if (GetResourceLocations(key, typeof(object), out locations))
    11.             {
    12.                 foreach (var dep in GatherDependenciesFromLocations(locations))
    13.                     Caching.ClearAllCachedVersions(Path.GetFileName(dep.InternalId));
    14.             }
    15. #endif
    16.         }
     
  33. PascalZieglerAzuryLiving

    PascalZieglerAzuryLiving

    Joined:
    Aug 3, 2020
    Posts:
    11
    for me that works fine. maybe you need to release the download handle first.
     
  34. PascalZieglerAzuryLiving

    PascalZieglerAzuryLiving

    Joined:
    Aug 3, 2020
    Posts:
    11
    Case number is 1272887. It's still open and I expect it to stay that way for a long while.
     
  35. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    Yeah I figured it out that before removing a bundle must call bundle.Unload(). Now everything work pretty fine.
     
  36. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    I have a question!
    While the clear cache solution work fine right now. But it's seem that every scene is dependency with the builtinshader.bundle and clear cache will certainly gonna remove the bundle because of dependency.
    So each time after I remove 1 addressable that contains any scene, in order to other scene to load builtinshader.bundle must be redownload.
    For now when I'm clearing the cache I check for bundle's name contains "builtinshader" and ignore that.
    Are there anyway to tackles this, it's kinda well... uncomfortable knowing this issue.
     
  37. PascalZieglerAzuryLiving

    PascalZieglerAzuryLiving

    Joined:
    Aug 3, 2020
    Posts:
    11
  38. tealm

    tealm

    Joined:
    Feb 4, 2014
    Posts:
    108
    Yeah I did, from initial testing it seems to work fine. :)
    Still using
    ClearAllCachedVersions()
    but with proper bundlename now through
    Caching.ClearAllCachedVersions((dep.Data as AssetBundleRequestOptions).BundleName)
     
  39. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    At my end the Addressables.ClearDepenendcyCache of version 1.16.1 still do nothing. Wonder if I get any wrong or something! No log/error/warning and cache still persist
    Tested on Unity 2018.4.9f1(LTS)
     
  40. tealm

    tealm

    Joined:
    Feb 4, 2014
    Posts:
    108
    Make sure you have released all assets you are trying to clear the cache for @Kultie, you can use the Event viewer to make sure your ref count is zero.
     
  41. Kultie

    Kultie

    Joined:
    Nov 14, 2018
    Posts:
    48
    @tealm Thanks for the information
    I have a question since i'm not at work and can't checking the event viewer rn.
    Will the ClearAllCachedVersions() clear static bundle/asset if some "dynamic" resource depend on it?
     
  42. Tayfe

    Tayfe

    Joined:
    Nov 21, 2011
    Posts:
    103
    Are there any news on this issue?

    I'm using Unity Editor 2019.04.20f1 and Addressables 1.16.10 and this bug should have been fixed in 1.16.1 but it doesn't work for me?! Nut sure whether there is a problem with my code but it's actually quite simple. The AsyncOperationHandler of
    Addressables.ClearDependencyCacheAsync(key)
    returns Succeeded and true but the addressables isn't deleted at all.
     
  43. inkletom

    inkletom

    Joined:
    Oct 13, 2016
    Posts:
    63
    Tayfe likes this.
  44. julio_kolbapps

    julio_kolbapps

    Joined:
    Mar 2, 2021
    Posts:
    32
    Hi Guys. Can I ask a question a little out of script but still in context?
    Do I need to use DownloadDependency before checking catalogs that need to be updated?
    If the answer is no, when should I use DownloadDependency?