playMaker

Author Topic: StartCoroutine and WWW[SOLVED]  (Read 1491 times)

caesarhernandez

  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
StartCoroutine and WWW[SOLVED]
« on: May 20, 2015, 04:52:53 PM »
Hello,

Unity seems to be locking up when I use the StartCoroutine action and a GameObject with a script attached using an IEnumerator return type. Basically I'm trying to use StartCoroutine to download a scene bundle. I have a game object with a script called BundleMasterScript.cs with a download method like this:

Code: [Select]
    public IEnumerator DoTheDownload()
    {
        Caching.CleanCache();
        var download = new WWW("http://[some website].com/am_web/bundles/Android/version5scene5.txt");
        yield return download;
        var bundle = download.assetBundle;
        Application.LoadLevel("scene5");
    }

Then I use the StartCoroutine action to invoke the method - see attached image. (The action after the StartCoroutine is empty.)

Unity always locks up and I do not understand where or why it is happening - so I'm starting in Playmaker forum since this is my implementation. Is there something else I need to do here? I'm using Unity 4.6 and a relatively recent version of Playmaker (I think I updated it about 3 months ago)

« Last Edit: May 21, 2015, 03:48:08 AM by jeanfabre »

caesarhernandez

  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
Re: StartCoroutine and WWW
« Reply #1 on: May 20, 2015, 04:54:42 PM »
This used to work BTW...the site is definitely accessible and the bundles are built correctly; it just suddenly stopped working a couple of days ago and I'm struggling to figure out why or where I should start to debug this.

thanks

caesarhernandez

  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
Re: StartCoroutine and WWW
« Reply #2 on: May 20, 2015, 05:14:35 PM »
Ok the issue seems to be when I try to do the Application.LoadLevel("scene5"); I commented it out and it does not freeze any longer. I suspect the problem is in "scene5"

caesarhernandez

  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
Re: StartCoroutine and WWW
« Reply #3 on: May 20, 2015, 05:19:26 PM »
Ok I figured it out - the problem was in the scene5 that I was trying to load.