Let's push Boo forward! http://feedback.unity3d.com/forums/15792-unity/suggestions/2944879-flawless-different-script-languages-integration :P
Answer by AngryAnt
Oct 19, 2009 at 08:55 AM
If you are planning to work with other programmers on a Unity project, I very much recommend that you decide from the beginning to work in the same language. While it is completely possible to combine scripts written in multiple languages into one project, you will very likely at some point run into issues due to the nature of the task of compiling and linking multiple languages.
Is there any easy way for script/syntax translation from C# to JS or JS to C# ?
@sidhi It doesn't make much sense to post a question like that on a 5 year old answer to another question. Also.. you could use google.. http://lmgtfy.com/?q=convert+between+c%23+and+unityscript#
I am so late... Can C# do things JS can't?
Answer by benblo
Oct 20, 2009 at 04:24 PM
Ah, thanks Lucas for this invite to flamewars :) !
After over 2 years working with Unity, I've come to the conclusion that using UnityScript is a Bad Idea. Always.
I've started by using US, switched after a couple months, then a year later worked in US again with a different team... and we ended up porting all of our code to C# after 6 months (oh the joy), and fixed a billion bugs in the process.
Yes, C# has some overhead, its syntax is a tad more verbose (although you save all those useless vars and functions), and using typeof() is a bore (but as the API is ported to generics, this quickly disappears).
But US has so many shortcuts that are just invitations to make mistakes, you'll lose the time tenfold just tracking bugs! The biggest, most awful thing is implicit variable declaration. Can you spot the error in there?
if (myvar > 0)
// bla bla bla...
I've mispelled myVar to myvar in Update, so the compiler will create a new local variable (that will default to 0), so the if will never happen, regarless of what you set myVar to in the editor. Happy head-banging.
You will get NO WARNING WHATSOEVER from the compiler, since implicit declaration is legal (even with #pragma strict), effectively forfeiting the benefit of using a compiled scripting language instead of an interpreted one. There are tons of others pitfalls, but this one alone is worth using C#.
The number 2 reason is Visual Studio: with Intellisense and inline help, you'll be learning and discovering the API as you type.
Visual C# Express is free (as in beer not speech). There is simply no better code editor on the market, at least for .NET development; if someone tells you otherwise, they're either misinformed, or fanboys of some other tool. Or just hate MS or non-open source.
Less notable: you can get lower performance if you use US the wrong way... you can prevent yourself from using it the wrong way by using #pragma strict (but by using C#, you can prevent much more!)
And lastly, with C# you have access to some .NET mechanisms than haven't been ported to US: properties, delegates, lambdas, generics... not something that will really affect you when you start programming, but once you taste their power you sorely miss them.
bla bla bla
Unknown identifier: 'myvar'
Delegates are probably the most important thing I have used when creating menu systems...so don't overlook it....
I have to agree about Visual Studio. For all the amazing software Apple creates Xcode is horrible; Xcode 4 is so buggy and slow it's ridiculous. This is the one place where they should copy from Microsoft since MS really got VS right.
Implicit type declaration is easily avoided by using pragma strict. The biggest issues with UnityScript are the overhead (file size and minor performance) for mobile in particular and problems interoperating with C# libraries such as UIKit that are based on C#'s delegate pattern (you can use them, but you need to write helper code in C#).
In the end C# is better supported than UnityScript and properly documented, but in terms of bugginess, I think that's more the coder than the language.
Answer by PsychicParrot
Oct 21, 2009 at 11:54 PM
Answer by Ricardo
Oct 20, 2009 at 01:38 PM
See also this question on the performance difference.
@Ricardo, you could rename the URL to indicate what the Question is - would make it more clear.
Good point, thanks.
@Ricardo, Cool, +1. :)
Answer by abdullah.ahmed
Nov 09, 2009 at 06:54 PM
Depends on a few factors
1- Do you know any of the languages to begin with? Or if you know more than one then are there any of the languages you are more comfortable with? If so start learning using that language in the short term atleast.
2- IDE: Visual Studio is generally known as the best development IDE out there and Visual C# Express is free. I find intellisense and the features provided by C# tend to save me a lot of time and effort. I am equally comfortable in JS or C# but C# takes the cake in terms of performance and productivity. I really dont think there is much of an overhead (if any at all) associated with c#.
4- If you find C# a bit daunting because you find C/C++ to be difficult, then you may psychologically find it harder to learn C#. I myself hate to work with C or C++ but love C# and I had no difficulty picking it up at all whereas C/C++ always gave me a lot of trouble.
I think in the short and long run it will pay off to use C#. However I know a lot comes to personal preference.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users post good questions and use the site effectively we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
11 People are following this question.
Question regarding this line of code