I have a big ugly nested loop in a coroutine which takes, on average, .07 seconds to complete. This is enough to cause a stutter during gameplay. I seem to have hit a wall in my understanding of loops, coroutines, or both.
It is not necessary for this loop to complete in one frame, so I was hoping there’d be a quick and easy way to yield and return to it. Within the loop, I thought I could do something like this:
if (i % 4 == 0)
{
yield continue new WaitForFixedUpdate();
}
But I haven’t worked with C# in Unity before now, so I’m not sure what I’m doing. My only option in yielding seems to be using ‘return’. A nudge in the right direction would spare me some confusion.
Thanks for your time,