More Effective Coroutines (MEC) is an improved implementation of coroutines.
When you use Unity's built-in default coroutines you will have to be very careful about how you use them or else they will allocate memory that the garbage collector later has to clean up. This can cause your app to randomly skip frames. MEC solves that issue for coroutines, while also making coroutines more powerful by running about twice as fast as Unity's default coroutines do and providing you with a host of new options that Unity's default coroutines don't have.
This is the Pro version. The free version of MEC contains the mininum set of features, whereas the Pro version contains the full set. Both versions run on the same super-fast core.
Switching between MEC coroutines and Unity's default coroutines is really easy. They can even be used side by side in the same project.
Advantages of MEC (both free and pro):
- MEC doesn't require that your class inherit from MonoBehavior in order to run a coroutine.
- Coroutines can be "tagged" with a string when created, allowing you to kill or pause coroutines individually or as a group.
- MEC contains no pre-compiled DLLs, which makes debugging easier.
- MEC contains useful extra segements, like SlowUpdate.
Additional features found in Pro:
- Additional segments: All the segments that are included in the free version, plus RealtimeUpdate, EditorUpdate, EditorSlowUpdate, EndOfFrame, and ManualTimeframe.
- Additional functions: RunCoroutineSingleton for when you want to ensure that there is only ever one instance of a particular coroutine running at a time. SwitchCoroutine changes the timing segment or tag of a coroutine while running.
- Extension methods: Delay adds a delay to the beginning of a coroutine. Append and Prepend automatically run one coroutine as soon as the previous one finishes. CancelWith extends the coroutine to automatically stop when a given condition goes out of scope. Superimpose runs two coroutines together. (which can be useful for wait or kill operations.) Hijack changes the return value of a coroutine. (which can be useful when you want to run the exact same code, but in slow motion).
- A lot of additional ways to control a coroutine from just the handle, such as changing the segment, layer, tag, or even ending it.
- Coroutines can be grouped so that when one is terminated or paused the others in the group do the same.
For more informantion, see the documentation here.
Disclosure: This post may contain affiliate links, which means we may receive a commission
if you click a link and purchase something that we have recommended
While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!