I'm addicted to using Coroutines. Any alternatives?

There’s nothing magical about coroutines or code in a coroutine. Once you understand they are just a generator that Unity (by agreement) pumps for you, you can begin to think about whether they are useful for each of your particular purposes, as well as reason about how to do more complicated things with them.

For instance, you could make and run your own coroutines at whatever interval or frequency or convention you like. This gives you the ability to selectively run and inhibit running of different coroutines, if that’s a thing you need.

Just beware of unbounded complexity of having what essentially behaves like multiple paths of code execution, even though it really is not multitasking in any way.

Coroutines in a nutshell:

Splitting up larger tasks in coroutines:

Coroutines are NOT always an appropriate solution: know when to use them!

“Why not simply stop having so many coroutines ffs.” - orionsyndrome on Unity3D forums

Our very own Bunny83 has also provided a Coroutine Crash Course:

1 Like