Early last year, I wrote a blog post which explained how Unity's coroutines work. In my conclusion, I expressed that I underestimated the level of wizardry they involved, so much so that it went far beyond the scope of the article. I figured it was time to perhaps elaborate on that, and show you a glimpse of Unity's game loop and how the coroutine system works in the engine (at least, my interpretation of it.)
@djlink I fucking hate this too. It's not just stupid design, this is blatant asshole design. They want to try any and all tricks to have you accept tracking cookies.
How do Unity’s coroutines actually work?
Oliver
•
Updated 2 years ago
Coroutines in Unity are a way to run expensive loops, or delays in execution, without having to involve multithreading.
That's right – although it's commonly believed that coroutines are multithreaded operations, they in fact run on the
main thread. But have you ever asked yourself why coroutines return IEnumerator
? What does that even mean? We'll take
a
look at how they work, and I hope to explain just how genius they are.