- Home /
Does the www.isDone function actually work?
I'm trying to download asset bundles inside the editor. Yield does not work inside the editor so I need to use an update loop and the www.isDone method to track when the download is finished. For more info see previous post.
So, I've been doing some tests with asset bundles using the isDone function rather than yield and it seems that the isDone function never actually gets run. Here's the function I'm testing which runs every frame:
static var download : WWW;
function EditorUpdate () {
print("editor update running. download="+download);//this prints every frame yey!!
if(assetRequested==false)//I just do this so the request only gets made once
{
assetRequested=true;
LoadAssetBundle("someBundle.unity3d");
}
if (download.error != null) //no errors get reported..
{
Debug.LogError(download.error);
DebugConsole.Log(download.error);
}
if (download.isDone)
{
//NEVER GETS HERE :(
print("download done inside editor");
assetRequested=false;
}
//A test
print("progress="+download.progress);//this prints 0 and then 1 after a few seconds
}
As I noticed that the download.progress was actually reaching 1, I tried swapping it for the isDone event, however this just then returns an error if I then try to instantiate the asset bundle saying that the bundle hasn't finished downloading.
Does anyone know if isDone actually works for asset bundles? I read on another post that it had 'a bug' but there was no more info. Can anyone help me with this issue? WHat other way can I detect if an assetbundle has downloaded without using Yield?
P.S. I have a pro licence, the download url is correct, a crossdomain policy file and build settings are set to webplayer.- ie This download works fine using a yield function.
Cheers!
Answer by grimmy · Feb 02, 2012 at 07:17 AM
Okay, this is a hack, but if I oscillate an object in the scene, the download works fine. Eg.. (inside the Update loop):
this.gameObject.transform.position.x+=0.0000001;
this.gameObject.transform.position.x-=0.0000001;
wtf? I guess the ultimate answer to this question is 'wiggle it a bit'.
Your answer
![](https://koobas.hobune.stream/wayback/20220613063648im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do you set asset bundle name on prefab through code? 0 Answers
Missing textures & materials in asset bundle 1 Answer
When looping through assetbundle assetdatabase how do you reference a material object 0 Answers
Loading Assetbundles in Editor-script 2 Answers
Load Asset Bundle in Editor 3 Answers