Languages

This is my first post, and it’s about languages.
I know it’s a kind of FAQ, but I could not find the clear answer.
I will begin to use unity3d very soon, as I am a developer I use different languages or tools(C, C++, CBuider, Omnis Studio etc…).
In that case, should be better to work with C# rather than Javascript , right ?

Yeah, it is a FAQ :wink: … and there’s plenty of threads about it, but you’re right: There is no “clear answer”.

Or maybe, there is: If you know C and C++, C# is the way to go.

UnityScript is more compact, more implicit and less verbose, which some people prefer - but personally, I like the more explicit style of C# (and the clear specification of what the language is) significantly better than the other.

One thing to consider if you have Windows at hand (e.g. on a virtual machine): You can conveniently use Visual Studio for C# development. So that way, you have a real IDE instead of “some text-editor with some programming features”.

It’s all a matter of taste, really. I came from a C++ background and I found C# a more comfortable place to start.

The main benefit of Unity’s Javascript over C# is that you can type less code in a lot of cases. The main downside is that the language’s exact behaviour isn’t well documented and it has incomplete implementations of some features that you might care about, such as its equivalent to C#'s delegates. C#, on the other hand, is thoroughly documented, predictable and dependable, although Unity’s own docs are biased towards Javascript and you’ll have to figure out the relationship to C# for yourself.

If you’re confident with using different languages, you might also want to consider Boo, but you’d be pretty much on your own because hardly anyone uses it with Unity. It arguably has the most sophisticated features out of the three languages.

This topic comes up quite often, so you might want to search for older threads to see some other viewpoints.

… PS: There’s documentation available on how to set up Visual Studio for use with Unity at: http://www.unifycommunity.com/wiki/index.php?title=Setting_up_Visual_Studio_for_Unity … some people think the “Add-On for Convenient Adding of Unity Scripts” is not so convenient and instead directly set up their VS project in the Unity assets folder, so that’s another option of how to set it up (both have their pros and cons, as usual :wink: ).

Besides the language specific stuff mentioned by Neil and Jashan, there’s also the spread of the language which has been briefly touched as well. Generally I see the spread of the languages like this:

Unity documentation
JavaScript / UnityScript
MSDN and mono .NET documentation
C#
Wiki
2/3 JavaScript / UnityScript
Random .net related sites
C#
Forum
4/5 JavaScript / UnityScript

And for some reason Arges chose to use Boo in a tutorial he did on arges-systems.com - not really sure why :stuck_out_tongue:

I’m from a C++ background as well and I very much prefer statically typed languages plus I like that the available .net documentation is in the language I’m using, so I use C# as well.

Note that whatever you choose, its not that hard to “translate” examples and advice between the three. You really should choose what you feel most comfortable in.

Thanks for the replies.

So I’ll try to make the effort to use C#…
Coming from 3D gamestudio, I would appreciate this time to have a professional O.O. approach, even if it’s harder to begin.

I just hope to be able to climb the first steps… :?

By the way, my first project is for iPhone, no problem ?
What about MonoDevelop ? (I don’t want to see Windows on my new Mac :wink: )

There’s one interesting thing to note about that: Translating from UnityScript to C# is trivial because you just have to remove stuff. Ok, there’s some “var” you have to add before variable declarations, and there’s also some “twisting variable names and types” (“type name” in C# becomes “var name : type” in UnityScript), but in general it should be pretty trivial.

When converting UnityScript to C#, however, you run right into the main disadvantage of a langauge that has most stuff somehow implicit and is very non-verbose: You simply don’t have enough information.

Once you’re familiar with the APIs, this is no issue, because you know what is what - but as a Unity beginner, it’ll make you look up the documentation a lot.

On the other hand: Once you’ve done this a few times, you’re no longer a total noob so at least for me I can say that having most Unity scripting documentation in UnityScript (and really not allowing UnityScript stuff in my project) has helped me quite a bit with learning the API (and I’m using the UnityScript based resources a lot and find them very useful; now when I have something in UnityScript, it usually just takes me a few minutes until it looks “nice” … in C#).

That said: My opinion is that for newcomers, it would probably be easier to have the examples in a language that is less implicit and more verbose because you get an understanding of “what’s going on with this code” much easier if “what’s going on with this code” is typed out instead of somehow magically done by the compiler or runtime. The other opinion would be that it’s less overwhelming for people when they get less information. Could be a valid point to (for others :wink: ).

Well … opinions, I know :wink:

Only thing I can think of that can be a little disappointing is that currently, there’s no generics on the iPhone; it’s basically .NET 1.1 IIRC.

Oh, personally, I think Windows is pretty nice. As long as it’s running on virtual machines, as guest :wink:

I think there was some discussion on MonoDevelop on these forums; might be an option. I think some people are even using it for Unity development.

I’m twisted that way. :slight_smile:

Mostly I wanted to try out Boo. It was a good exercise to remember how I hated Python’s “I’m going to throw a fit if you accidentally mix spaces and tabs” syntax, and it made me long even more for C# 3.0 in Unity.