Coroutines • Performance

More Effective Coroutines

Coroutines that run about twice as fast as Unity's, with zero per-frame allocations, and a pile of functionality Unity never gave you. Run them anywhere with no MonoBehaviour, control them by tag, layer, or handle, chain and delay them, and reach into extra timing segments when you need them.

// Unity
StartCoroutine(_CheckForWin());

// MEC: runs anywhere, no MonoBehaviour
Timing.RunCoroutine(_CheckForWin());
Timing.RunCoroutine(_Tick(), Segment.SlowUpdate);
2xfaster than Unity's coroutines
0per-frame memory allocations
8timing segments in Pro

Built to drop in

Same structure. More power.

MEC keeps Unity's familiar yield-return shape, so switching over is mostly find-and-replace. Add two using statements, swap StartCoroutine for Timing.RunCoroutine, and you immediately get a central runner that does not stop just because a GameObject was disabled or destroyed.

using System.Collections.Generic;
using MEC;

private IEnumerator<float> _CheckForWin()
{
    while (_cubesHit < TotalCubes)
        yield return Timing.WaitForOneFrame;
    WinText.text = "You win!";
}

Why developers switch

Coroutines that pull their weight.

Zero per-frame allocations

No garbage generated each frame, and the infrastructure runs about twice as fast as Unity's. Rock solid under load.

Run anywhere

No MonoBehaviour required. One central runner means coroutines keep going even when an object is disabled or destroyed, unless you choose otherwise with CancelWith.

Timing segments

Update, FixedUpdate, LateUpdate, and SlowUpdate out of the box. Pro adds Realtime, End-of-Frame, Late-Fixed, and Manual.

#

Tags, layers, handles

Identify coroutines individually or in groups, then pause, resume, or kill them in a single call. Move one to a different segment on the fly.

Helpers built in

CallDelayed, CallPeriodically, CallContinuously, and WaitUntilDone cover the patterns you reach for constantly, without writing a coroutine for each.

Pro power tools

Singletons, Delay, Append and Prepend, Superimpose, Hijack, handle properties, and OnDestroy callbacks for full control.

Editions

Start free. Go further with Pro.

The free version is a complete, production-ready coroutine system. Full comparison in the docs.

MEC Free icon

MEC Free

A complete, faster coroutine system

  • Zero per-frame allocations
  • Update, Fixed, Late, and Slow segments
  • Tags and batch operations
  • CancelWith and WaitUntilDone
  • CallDelayed, Periodically, Continuously
MEC Pro icon

MEC Pro

Everything in Free, plus the full toolkit

  • Singletons and coroutine layers
  • Realtime, End-of-Frame, Late-Fixed, Manual segments
  • Rich handle control and OnDestroy callbacks
  • Link, Delay, Append, Prepend
  • Superimpose and Hijack

Questions about coroutines?

Join the Digital Dust Discord for help migrating from Unity's coroutines, performance tips, and direct support.

Join the Discord