WWW.isDone never true in Editor Script. (Editor Goes to Sleep)

Trying to build some Editor tools for my co-workers, necessitating grabbing of assetbundles from WWW reads.

In the following script (from an EditorWindow class) the Console shows a single debug message tagged A1, followed by a message per "frame (tagged A2) indicating the www.progress goes from 0 to 1 smoothly in a fraction of a second, but the A3 message is never produced.

Attempting to use www.progress instead of www.isdone gets solid errors when I try to use the asset, informing me that it is incomplete.

Coroutines are pretty much out of the question due to this being in Editor rather than runtime. I’ve gone through a few items both here and from the wiki, but always end up with progress stating it is complete, and isdone saying it isn’t.

I’ve been working with Coroutines and assetbundles in runtime on web and windows standalone compiles for months. The particular files being loaded here work fine in both. Plus I’ve checked the URL string and it downloads freely from the server through a browser, as well as loading correctly to built standalone and web build.

Anything obvious I’ve missed, or Arcane that I need to know?

Edited to Add:
It seems that the entire Editor Window is going to sleep unless I keep opening and closing other items in the project or hierarchy. As long as I keep clicking randomly around the editor UI the WWW request does eventually return true. Is there a way of making the editor not go to sleep under specified circumstances?

`
public void Update()
{
    if (start == true)
    {
        Debug.Log("A1");
        run = true;
        start = false;
        request = new WWW(assetURL);
    }
    else if (run == true)
    {
        Debug.Log("A2 ["+request.progress*100+"%]");
        if (request.isDone)
        {
            Debug.Log("A3");
            run = false;
            finished = true;
            if (request.error != null) { Debug.LogError(request.error); }
            else
            { AssetLibrary.assetlibrary.LoadSet(request, assetURL); }
        }
        else { assetProgress = request.progress; }
    }
}
`

start, run and finished are static bools, assetURL is a static String and request is a static WWW.

I don’t know if you’ve seen my post on my question but I figured it out :slight_smile: here’s the code

// UnityScript
@script ExecuteInEditMode()




class MyWindow extends EditorWindow {

    private var www : WWW;
    var target : Renderer;
    var texture : Texture2D;

    @MenuItem ("Window/My Window")
    static function ShowWindow () {
        EditorWindow.GetWindow (MyWindow);
    }

    function OnGUI () {
        if(GUILayout.Button("Download")){  LoadTexture("http://download.unity3d.com/webplayer/images/unity-icon-big.jpg"); }
        texture = EditorGUI.ObjectField(Rect(3,60,200,20),"Add a Texture:",texture,Texture);
        if(texture){
            EditorGUI.DrawPreviewTexture(Rect(25,150,100,100),texture);
        }
    }
    /*function OnEnable(){
        LoadTexture("http://download.unity3d.com/webplayer/images/unity-icon-big.jpg");
    }*/

    function LoadTexture(url)
    {
        www = new WWW(url);
        #if UNITY_EDITOR
        if (!EditorApplication.isPlaying)
            EditorApplication.update = MyUpdate;
        else
            WaitForDownload();
        #else
        WaitForDownload();
        #endif
    }

    #if UNITY_EDITOR
    function MyUpdate ()
    {
        if (www.isDone)
        {
            EditorApplication.update = null;
           LoadCompleted();
        }
    }
    #endif

    function WaitForDownload()
    {
        yield www;
        LoadCompleted();
    }

    function LoadCompleted()
    {
        //target.sharedMaterial.mainTexture = www.texture;
        texture = www.texture;
    }
}