Search Unity

CoroutineScheduler wiki script or All About Coroutines

Discussion in 'Made With Unity' started by snoopbaron, Feb 18, 2010.

  1. snoopbaron

    snoopbaron

    Joined:
    Mar 21, 2009
    Posts:
    88
    I've contributed a custom coroutine scheduler to the Unity community wiki. I needed special control over coroutines in a project so I implemented my own coroutine scheduler that works similar to the one built-in to Unity. While most projects will not need this script and are better of just using the built-in scheduler, the script may help you better understand how coroutines work behind the scenes. It is also useful if you want to add coroutine support to a non-Unity based project.

    Here is an article that I wrote for my old blog that goes into more detail. I'm moving it here in preparation of updating my site:

     
    Last edited: Jan 30, 2014
  2. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    Hi,

    Your need for scheduling coroutines makes sense to me ;)
    I see your have a public member in the CoRoutineNode that is named finished. I think it would be useful to expose this flag from the Scheduler providing we can identify a coroutine effectively. This would enable to know when a coroutine is finished in a condition.
    Also, it would be nice to launch a coroutine in loop mode(easy to implement).
    Also, it would be nice to have a stop and pause behavior on given yields, for a given coroutine.

    I ll think of something, unless you see some issues that makes this impossible to do.