Timeline for Why even use coroutines in Unity?
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 16, 2020 at 10:15 | history | edited | CommunityBot |
Commonmark migration
|
|
Jan 4, 2019 at 14:55 | comment | added | Draco18s no longer trusts SE | Linking components in the inspector does cut down on the lookups, yes, but you can't always do this. Think about a coroutine you would use to monitor, say, a power-up effect. You wouldn't want that script to exist all the time, you'd only want it to exist when it was needed. As for the complexity, not necessarily. A coroutine that waits for a coroutine isn't that complex, it's just a function call inside a function. | |
Jan 4, 2019 at 7:15 | comment | added | ZombieTfk | Nice. Your first, third and last points are especially interesting. As for your second and fourth though, isn't coupling between components by linking them in the inspector done exactly to avoid the use of getcomponent in a scenario like this, and if your coroutine's lifecycle was as complex as you set out in your fourth point then wouldn't that actually be an argument in favor writing a new component class? (an example would be very much appreicated to demonstate what you mean here!) | |
Jan 4, 2019 at 6:27 | history | answered | Draco18s no longer trusts SE | CC BY-SA 4.0 |