unity programming update: "i want a generic way to play back a sequence of actions" --- me, ten seconds before reinventing coroutines from first principles
this post inspired by looking at the interface i just wrote and realizing it's pretty much just IEnumerable but without the compiler magic
dunno how off base i am but unity's implementation of coroutines really seems like a shiny rake labelled "step on me" huh
@eclairwolf yeah they’re uh,, bad. for a lot of reasons, actually
there’s a few third party options out there that are pretty good
@eclairwolf like the three major problems i have with the standard coroutines is that you can’t return values from them, they’re not very well synced to the game loop, and they generate a ton of garbage and GC pressure if you’re not careful.
@eclairwolf Aren't coroutines a C# thing rather than a Unity thing? I haven't looked at this in a long time
@socks they're kinda halfway in between a language feature and a library thing - c# does some fancy compiler things to turn IEnumerable generator functions (yield return) into state machines under the hood, which is 99% of the way to being a coroutine, and unity has an api for scheduling them
since it's an old unity feature it's 99% footgun by volume tho