One of the comments on this thread: Checking condition and calling continuous method with periods of delay unity, said that:
Never never ever use coroutines. They teach bad habits from the point of view as a c# developer and will lead to a lynching if you take a regular c# job
My question is, why is this? Is this just in Unity or in general? Unity's official virtual reality samples https://www.assetstore.unity3d.com/en/#!/content/51519 use them very heavily (especially the flyer example) instead of Invoke or Invoke Repeating, these sample projects were released recently as well.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
This is very much a Unity thing, though the advice is applicable anywhere.
Developers do not expect iterating an IEnumerable
to change a program's state. It's not what IEnumerable
is intended for and is an inconsistent behavior with all of .NET.
What Unity is doing is using yield return
as a pseudo-coroutine, and it's going to cause confusion for any devs unfamiliar with that.
In modern C# we have async/await to accomplish what Unity intended, but Unity was made before that feature was available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With