Always jarring to see how Unity is stuck on an ancient version of C#. The use of IEnumerable as a "generator" mechanic is quite a good hack though.
Thankfully they are actively working towards upgrading, Unity 6.8 (they're currently on 6.4) is supposed to move fully towards CoreCLR, and removing Mono. We'll then finally be able to move to C# 14 (from C# 9, which came out in 2020), as well as use newer .NET functionality.
https://discussions.unity.com/t/coreclr-scripting-and-ecs-st...
>The use of IEnumerable as a "generator" mechanic is quite a good hack though.
Is that a hack? Is that not just exactly what IEnumerable and IEnumerator were built to do?
Not that ancient, they just haven't bothered to update their coroutine mechanism to async/await. The Stride engine does it with their own scheduler, for example.
Edit: Nevermind, they eventually bothered.
IIRC generators and co-routines are equivalent in a sense that you can implement one with the other.
Not too different from C++'s iterator interface for generators, I guess.
Unity is currently on C# 9 and that IEnumerable trick is no longer needed in new codebases. async is properly supported.