Hey, I’m trying to figure out how to use these coroutines. Basically I wan’t to create something like the WWW class, where I can just do something like the following,
Request req = new Request();
yield return req.Execute();
Debug.Log("This is executed after the long Execute method is finished processing.");
Any ideas how I might be able to do something like this? I tried implementing my Requests Execute method like so, but it’s not a MonoBehaviour so StartCoroutine does not work.
public IEnumerator MyRoutine()
{
while(processing)
{
yield return null;
}
}
public IEnumerator Execute()
{
Debug.Log("EXECUTE");
yield return StartCoroutine("MyRoutine");
}
Is WWW a special class that has some serious Unity magic behind it which is unavailable to the rest of us mortals? Thanks.