Coroutines are a fundamental building block of Unity scripting. In 5.3, we got a new class to make them more powerful: CustomYieldInstruction
. Today we’ll look at it and see if we can make an arbitrarily-interruptible YieldInstruction
so our coroutines can abort the things they yield
. Read on to see how and to compare against the old 5.2 way!