Quantcast
Channel: Questions in topic: "assetbundle"
Viewing all articles
Browse latest Browse all 1593

Getting "The unity3d file is not a valid asset bundle" error

$
0
0
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( ResourceRequest 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); }

Viewing all articles
Browse latest Browse all 1593


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