IEnumerator WWWLoader()
{
WWW bundleRequest = new WWW("*****************");
while(!bundleRequest.isDone)
{
yield return null;
}
AssetBundle bundle = null;
if (bundleRequest.bytesDownloaded > 0)
{
AssetBundleCreateRequest myRequest = AssetBundle.LoadFromMemoryAsync(bundleRequest.bytes);
while(!myRequest.isDone)
{
Debug.Log("loading....");
yield return null;
}
if (myRequest.assetBundle != null)
{
bundle = myRequest.assetBundle;
GameObject model = null;
if (bundle != null)
{
AssetBundleRequest newRequest = bundle.LoadAssetAsync<GameObject>("Log");
while (!newRequest.isDone)
{
Debug.Log("loading ASSET....");
yield return null;
}
model = (GameObject)newRequest.asset;
bundle.Unload(false);
}
}
else
{
Debug.LogError("COULDN'T DOWNLOAD ASSET BUNDLE FROM URL (assetBundle = null)");
}
}
else
{
Debug.LogError("COULDN'T DOWNLOAD ASSET BUNDLE FROM URL (0 bytes)");
}
}
This is my code to load an AssetBundle (I've removed the URL). It gives me the error "Failed to decompress data for the AssetBundle 'Memory'." I'm not sure if 'Memory' is referring to the AssetBundle name because mine is called 'log' so is it referring to a problem with memory? Any help on understanding this error and fixing it is much appreciated.
So, I have gotten past the error by using UnityWebRequestAssetBundle as shown here (recommended by derHugo).
I was initially using a simple FTP server to access the assets and it would not allow me to download them (from Unity, but in a browser it worked fine). I then switched to using a Flask server, which worked like a charm.