- Home /
 
               Question by 
               dannypark · Feb 20, 2015 at 03:11 PM · 
                assetbundleassetbundleinvalid  
              
 
              Getting "The unity3d file is not a valid asset bundle" error
I'm using local assetbundle files (*.unity3d) to load assets. It works fine, but sometimes I get "The unity3d file is not a valid asset bundle" error. I don't know why, and the error does not always occur.
Does anybody know the cause of that error? I've done googling the error message, and nothing helped.
Here's my code on asset bundle loading.
 private static IEnumerator ProcessLoadAssetInternal<T>(
     ResourceRequest<T> arg, string bundleName, string assetName) where T : class
 {
     arg.Result = null;
     var www = new WWW("file://" + DataPath + bundleName + ".unity3d");
     while (www.isDone == false)
         yield return null;
     if (www.error != null)
         yield break;
     var bundle = www.assetBundle;
     if (bundle == null)
         yield break;
     var data = bundle.Load(assetName);
     if (data == null)
     {
         bundle.Unload(true);
         yield break;
     }
     if (typeof(T) == typeof(Texture2D))
         arg.Result = data as T;
     else
         arg.Result = Instantiate(data) as T;
     bundle.Unload(false);
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                