What is difference below 2 examples?
-
yield new WaitForSeconds(1);
-
yield WaitForSeconds(1);
Thanks.
What is difference below 2 examples?
yield new WaitForSeconds(1);
yield WaitForSeconds(1);
Thanks.
There is no difference, Javascript just allows you to omit the new keyword.
While captain picard is no doubt supposed to point out some major retardedness in my logic, I fear it doesn’t quite help me see it. Just plain explaining whatever I misunderstand tends to be more helpful.
I don’t think it was aimed at you personally, I think it’s just his usual complaint about any language that isn’t C#! ![]()
Yeah sorry, it was referring to JavaScript’s behaviour to create objects without the new keyword (in which case, how would you type-cast a WaitForSeconds object?), nothing to do with the fact that you pointed it out. Sorry, I just realized how ambiguous what it was directed to.
Tonyd, I have no problem with languages that aren’t C#, just so long as they’re good and stay in the domain they’re intended for. This is just one more thing about the language I can’t stand; that is, is the code calling a WaitForSeconds method or invoking a WaitForSeconds constructor?
I always thought WaitForSeconds was a function, not an object
I just learned something…
Well, it explains why tutorials always use new WaitForSeconds (earning a good habit as soon as possible).
And this is why I facepalmed; to me, this level of syntactical ambiguity is just redonkulous and has no place in a programming language.