We’re using Unity 2017.1.0f3 to download assetbundles from our server and store them in cache. To do so we use the UnityWebRequest class and its appropriat assetbundledownloadhandler.
When a download is finished, the assetbundle isnt stored anywhere other than the caching system, we do not put it in a list the way the assetbundlemanager does by default. Therefor in theory there should be no reference to it in memory. When the unitywebrequest is finished we call dispose on it, and we have the disposedownloadhandlerondispose set to true.
However, when we call clearallcachedversions for an assetbundle that was download in the same app run, we get a warning ‘assetbundle with hash xxxx still in use’, the only way to remove it is by restarting the app.
Hi, we have similar problem with ClearAllCachedVersions. There is no warning about usage of bundle, because it is unloaded, and ClearAllCachedVersions(“ourBundleName”) returns true, but bundle is not removed from file system Is it correct behaviour?
same here and im getting isane the maps load from a old version and the textures looks ugly and i cant load the new changes coz they are seems to be taking always a old version, i clean from locallow the files and do the clear code and sum a new num version but still cant see the changes ive done something its missed or weird here…
I have same trouble in Unity2017.4.2f2 and Unity2018.1.0f2
After I load AssetBundle, I call “Caching.ClearCache”, it return false because the asset is not unloaded.
Then, I also call “Caching.ClearAllCachedVersions”, it return true despite asset is not unloaded yet.
Furthermore, “Caching.ClearCacheVersion” also returns true despite asset is not unloaded yet.
After I unload that assetbundle, i tried call “Caching.ClearAllCachedVersions” and “Caching.ClearCacheVersion”.
but both APIs return true and don’t remove cache.
Only when I call “Caching.ClearCache” and it succeeded, both API ( “Caching.ClearAllCachedVersions” and “Caching.ClearCacheVersion” ) return false.
Are there API are implemented correctly ?
I wonder these API seem not to be implemented “remove cache”.
( Caching.IsVersionCached works correctly, so i use it for check behaviour)
I also encountered this problem
it seems that the directory wasn’t refreshed after it was manipulated so Caching handled it as if it was still there even though it isnt, same goes to Caching.IsVersionCached where it will return false when the app start, so i had to always redownload the bundle before it will return true even though it had been downloaded in the previous session of the game
Was this error fixed? My team is considering upgrading to 2018.2.17f1 - we use a similar pattern (downloading the bundle, immediately unloading, then loading it later from the cache if needed) and we’re concerned that this upgrade could break our mission-critical bundles content system.
The forums are for help / assistance and don’t guarantee a Unity Dev reply. That being said, I’ve yet to see a FogBug come through about this issue. Has anyone reported this issue with an attached repro project yet? If so what is the case number?
I got the same problem here with Unity 2018.3.7f1, and found a solution. The problem I found is because unity cache is saved in a folder with the “file name” and not with “bundle name”. So, the file name and the bundle name is not necessarily the same. The code below solved my problem:
Uri uri = new Uri(my_url);
string bundle_name = System.IO.Path.GetFileNameWithoutExtension(uri.AbsolutePath);
bool isCaching = Caching.ClearAllCachedVersions(bundle_name);