Hullo, I'm getting Unity this week, and I'm wondering which of the supported languages is generally thought to be best to script in, in Unity. I've been coding in actionscript for a while, and AS3 is my prefered language. I'm guessing from what I've seen of Javascript and C# that JS is closer (syntax-wise) to AS3, but I get the feeling I'd rather use C#... hehe So any opinions, pros cons, thoughts of AS3 users, would be really appreciated! Also, does scripting in Unity follow the whole class based system of coding that you use in AS3(I guess I'm meaning OOP, but these terms confuse me!)? Thanks for any help!
There are already several topics on this, which you can do a search on if you want some lengthy discussion on the issue. Here's a crazy idea though: try them all and see which one you prefer. There's a free 30-day trial of Unity so you don't have to wait for anything. --Eric
Unity's JavaScript has support for full Object Oriented programming. With support for classes, inheritance and virtual functions.
Does the javascript implementation of Unity support do{}while loops? Not being too familiar to javascript prior to using unity I've been just looking up on google to figure out the syntax and what java script supports in general, so far I've had no problem, but I can't seem to find a way to make do{}while() loops in Unity, I always get an error. Is there any link to any javascript reference that matches the one in Unity? Please forgive my ignorance if this is a very stupid question.
while ( condition ){ } Here's my attempt to document the key differences between "real" JavaScript and Unity "JavaScript". http://www.unifycommunity.com/wiki/index.php?title=Head_First_into_Unity_with_JavaScript
I know how to do while loops I just don't know how to do: do{ bunch of stuff }while(condition) This one will execute the code atleast once before testing the condition, has its uses but not a big deal if is not there. I know it's possible to do it in javascript or atleast I found some sites claiming you can. The reference is awesome, thanks a lot for posting that, it'll clear a lot of questions I had but was afraid to ask.
do { //bunch o' stuff } while (condition); did you try with a semicolon? I'd test, but don't have Unity in front of me.