I am downloading assetBundle using WWW.LoadFromCacheOrDownload(), it works fine and the bundle is downloaded successfully.
The issue is, when internet connection is broken while downloading the assetBundle, yield never return and error could not be handled.
using (WWW www = WWW.LoadFromCacheOrDownload(bundleURL, bundleVersion)) {
yield return www;
if (www.error != null) {
Debug.LogError("ERROR -- " + www.error);
}
}
Code used to generate the assetBundle:
string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource AssetBundle", "unity3d");
if (path.Length != 0) {
// Build the resource file from the active selection.
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path,
BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets,
BuildTarget.Android);
Selection.objects = selection;
}
↧