Quantcast
Channel: Questions in topic: "unloadunusedassets"
Viewing all articles
Browse latest Browse all 85

[AssetBundles] - Why is my assetbundle.unload not unloading assets and therefore cannot loadfromcacheordownload again ?

$
0
0
Hi all, I am looking for some urgent advice/help regarding asset bundle LoadFromCacheOrDownload. UnloadAssetBundle is called on a button click in the UI. loadedAssetBundle is a member variable of class that has the functions. The following are the steps I take : 1. LoadFromCacheOrDownload(URL, 0) <- Get a WWW download with assetbundle from the web. 2. The above is successfull the first time. I check the IsVersionCached -> Returns TRUE. 3. Call Unload(false) on the asset bundle then destroy the object. 4. Try LoadFromCacheOrDownload(URL, 0) again with the same asset bundle. 5. Get the error -> Cannot load cached AssetBundle. A file of the same name is already loaded from another AssetBundle. See code below : private AssetBundle loadedAssetBundle; public IEnumerator DownloadAtURL(string assetName, string URL) { Debug.Log("PRE ASSET CACHED = " + Caching.IsVersionCached(assetName, 0)); Debug.Log("Downloading using -> WWW.LoadFromCacheOrDownLoad"); var www = WWW.LoadFromCacheOrDownload(URL, 0); yield return www; if(!string.IsNullOrEmpty(www.error)) { Debug.Log(www.error); yield return null; } Debug.Log("Finished downloading assetbundle"); Debug.Log("POST ASSET CACHED = " + Caching.IsVersionCached(assetName, 0)); loadedAssetBundle = www.assetBundle; } public void LoadAssetBundle() { Debug.Log("Loading all assets for bundle " + loadedAssetBundle.name); loadedAssetBundle.LoadAllAssets(); } public void UnloadAssetBundle() { Debug.Log("Unloading asset bundle " + loadedAssetBundle.name); loadedAssetBundle.Unload(true); Destroy(loadedAssetBundle); } See output below : Download Asset POST : https://55AE.playfabapi.com/Client/GetContentDownloadUrl Get content download URL for asset : 1/Windows/Windows result : https://cdn.playfab.com/55ae/etc/1/Windows/Windows?Expires=1438065963&Signature=oJa3DBfiDyRyE2hHix~Wpm1VqLrfoBzLTvlbTlf2RjPGtcwVAJj1y6ms9gp102GLAd7FAT2d-VCpSFKRAXLUPD04tor4j7znLl7EWQqi6TgEyBeLwBp3XY8D69S8gD4EJFH3V54hUVNZmk0nRCKBp4pJqnph4y4-DcChuCiIx0U_&Key-Pair-Id=APKAIOVJ4VBNZZU4TTQA Downloading 1/Windows/Windows from https://cdn.playfab.com/55ae/etc/1/Windows/Windows?Expires=1438065963&Signature=oJa3DBfiDyRyE2hHix~Wpm1VqLrfoBzLTvlbTlf2RjPGtcwVAJj1y6ms9gp102GLAd7FAT2d-VCpSFKRAXLUPD04tor4j7znLl7EWQqi6TgEyBeLwBp3XY8D69S8gD4EJFH3V54hUVNZmk0nRCKBp4pJqnph4y4-DcChuCiIx0U_&Key-Pair-Id=APKAIOVJ4VBNZZU4TTQA PRE ASSET CACHED = False Downloading using -> WWW.LoadFromCacheOrDownLoad starting www download: https://cdn.playfab.com/55ae/etc/1/Windows/Windows?Expires=1438065963&Signature=oJa3DBfiDyRyE2hHix~Wpm1VqLrfoBzLTvlbTlf2RjPGtcwVAJj1y6ms9gp102GLAd7FAT2d-VCpSFKRAXLUPD04tor4j7znLl7EWQqi6TgEyBeLwBp3XY8D69S8gD4EJFH3V54hUVNZmk0nRCKBp4pJqnph4y4-DcChuCiIx0U_&Key-Pair-Id=APKAIOVJ4VBNZZU4TTQA https://cdn.playfab.com/55ae/etc/1/Windows/Windows?Expires=1438065963&Signature=oJa3DBfiDyRyE2hHix~Wpm1VqLrfoBzLTvlbTlf2RjPGtcwVAJj1y6ms9gp102GLAd7FAT2d-VCpSFKRAXLUPD04tor4j7znLl7EWQqi6TgEyBeLwBp3XY8D69S8gD4EJFH3V54hUVNZmk0nRCKBp4pJqnph4y4-DcChuCiIx0U_&Key-Pair-Id=APKAIOVJ4VBNZZU4TTQA cached to C:/Users/Peter/AppData/LocalLow/Unity/WebPlayer/Cache/InfinityPlusTwo_puzzleverse/26d9c28d789c254f71ea99a3463b99a7ccc2f4fa ----- Total AssetImport time: 0.065631s, AssetImport time: 0.000000s, Asset hashing: 0.000000s [0 B, 0.000000 mb/s] loading from cache: https://cdn.playfab.com/55ae/etc/1/Windows/Windows?Expires=1438065963&Signature=oJa3DBfiDyRyE2hHix~Wpm1VqLrfoBzLTvlbTlf2RjPGtcwVAJj1y6ms9gp102GLAd7FAT2d-VCpSFKRAXLUPD04tor4j7znLl7EWQqi6TgEyBeLwBp3XY8D69S8gD4EJFH3V54hUVNZmk0nRCKBp4pJqnph4y4-DcChuCiIx0U_&Key-Pair-Id=APKAIOVJ4VBNZZU4TTQA Finished downloading assetbundle POST ASSET CACHED = True Unloading asset bundle Download Asset POST : https://55AE.playfabapi.com/Client/GetContentDownloadUrl Get content download URL for asset : 1/Windows/Windows result : https://cdn.playfab.com/55ae/etc/1/Windows/Windows?Expires=1438065979&Signature=eLuGatsAj0-yGDjltOWYIQjBf~4oNtGFlvOcXhacjt0InZjLotfyWPAHAWW64j3UH06sTYfeC9OGmmOjTD~WkkYSLgu5qpLtad6e~DF-cYj3jiK~fblZMEKsTAqhlb3m8~ZnaHqfsFS9~PGjoipUTNHvMy0Yh0JKYwwpa~N3B0Y_&Key-Pair-Id=APKAIOVJ4VBNZZU4TTQA Downloading 1/Windows/Windows from https://cdn.playfab.com/55ae/etc/1/Windows/Windows?Expires=1438065979&Signature=eLuGatsAj0-yGDjltOWYIQjBf~4oNtGFlvOcXhacjt0InZjLotfyWPAHAWW64j3UH06sTYfeC9OGmmOjTD~WkkYSLgu5qpLtad6e~DF-cYj3jiK~fblZMEKsTAqhlb3m8~ZnaHqfsFS9~PGjoipUTNHvMy0Yh0JKYwwpa~N3B0Y_&Key-Pair-Id=APKAIOVJ4VBNZZU4TTQA PRE ASSET CACHED = True Downloading using -> WWW.LoadFromCacheOrDownLoad You are trying to load data from a www stream which had the following error when downloading. Cannot load cached AssetBundle. A file of the same name is already loaded from another AssetBundle. UnityEngine.WWW:get_assetBundle() [C:/buildslave/unity/build/Runtime/Misc/WWWCached.cpp line 265] (Filename: Assets/sdk/scripts/TestBedController_Dev.cs Line: 357) WWWCached data can only be accessed using the assetBundle property! WWWCached data can only be accessed using the assetBundle property! WWWCached data can only be accessed using the assetBundle property! WWWCached data can only be accessed using the assetBundle property! You are trying to load data from a www stream which had the following error when downloading. Cannot load cached AssetBundle. A file of the same name is already loaded from another AssetBundle. WWWCached data can only be accessed using the assetBundle property! WWWCached data can only be accessed using the assetBundle property! WWWCached data can only be accessed using the assetBundle property! Cannot load cached AssetBundle. A file of the same name is already loaded from another AssetBundle. Finished downloading assetbundle POST ASSET CACHED = True You are trying to load data from a www stream which had the following error when downloading. Cannot load cached AssetBundle. A file of the same name is already loaded from another AssetBundle. Any ideas why UNLOAD is not working ?! Seems like a bug in unity, not sure what else I can do here. Would be most appreciated and thanks in advance.

Viewing all articles
Browse latest Browse all 85

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>