- Home /
Question by
10001110101 · Apr 24, 2013 at 08:36 AM ·
wwwdownloadienumeratorwebasset bundle
Asset Bundle Download Crashing
Would this block of code be a problem for the Unity3D web player? And does the "streaming" button in the build settings have any affect on the web build itself?
// OMG No IEnumerator?! Is this safe? //
public static void downloadAssetBundle (string url, int version)
{
WWW www = WWW.LoadFromCacheOrDownload(url,version);
string keyName = url + version.ToString();
if(dictAssetBundleRefs.ContainsKey(keyName))
{
return;
}
while(!www.isDone)
{
if(www.error!=null)
{
throw new Exception("Something Bad Happened! " + www.error);
}
else
{
AssetBundleRef abRef = new AssetBundleRef(url,version);
abRef.assetBundle = www.assetBundle;
dictAssetBundleRefs.Add(keyName,abRef);
}
}
}
Comment
Truth about asset bundle is that it sucks. That's why there are some alternatives out there.
Your answer
Follow this Question
Related Questions
WWW Class behaves strangely on iOS 3 Answers
www.texture different in editor and on webplayer 1 Answer
Can WWW call a function in PHP like jQuery AJAX can? 1 Answer
POST to HTTP not working 2 Answers
Problem with WWW and webplayer 1 Answer