Optimizing Coroutines

--

In a game, we can have a GC (Garbage Collection) like this:

It’s not so much, but it is better to improve its performance

After diving into the EnemyDamage code, we may find this coroutine:

The yield return lines generate GC. To avoid this, we can cache those values:

--

--