Let's kick out unity's bad coroutine. Please free to use.
Sample in /Assets/Scripts/Coroutine/Sample
IEnumator Foo() {
yield return null;
}
CoroutineExecutor.Do(Foo());
var group = new GroupCoroutine(Foo());
group.Add(Foo());
CoroutineExecutor.Do(group);
var order = new OrderCoroutine(Foo());
order.Add(Foo());
CoroutineExecutor.Do(order);
// It will wait until receiving event
var ev = new EventCoroutine(new string[] {"ABC", "123"});
yield return ev;
// After some coroutine wait for event, You can send event by this way to trigger EventCoroutine to finish.
CoroutineExeCcutor.SendEvent("ABC");
// Then every EventCoroutine wait for "ABC" event will be finish.
yield return BaseCoroutine.WaitFor.FixedUpdate;
or yield return new WaitForFixedUpdate();
yield return BaseCoroutine.WaitFor.EndOfFrame;
or yield return new WaitForEndOfFrame();