Hacker News new | ask | show | jobs
by jayd16 84 days ago
So if you need to conditionally tick something or you want to wait for an effect to finish, etc., you're using Update() with if() statements?

The same code in a coroutine hits the same lifecycle failures as Update() anyway. You don't gain any safety by moving it to Update().

> No structured cancellation.

Call StopCoroutine with the Coroutine object returned by StartCoroutine. Of course you can just pass around a cancellation token type thing as well.

> Hidden allocation/GC from yield instructions.

Hidden how? You're calling `new` or you're not.

Instead of fighting them, you should just learn how to use coroutines. They're a lot nicer than complicated logic in Update().

1 comments

Enjoy shipping console titles that run at a constant 60 fps with no GC.

Again, fine for pet projects on PC :)

I'll continue to bite... What AAA 60+fps mobile game written Unity without coroutines are you referring to?
There's exactly 0 (zero) AAA games made with unity so it's going to be tough. They're all a terrible lag fest no matter how they're implemented
Genshin Impact makes billions and it's made in Unity. Seems to be good enough for them.