C# or JavaScript?

Hi there ppl.

I’m from Brazil and quite new to unity forums.

I’m starting to dig into unity’s world and got a question about what’s the best language to start with.

I know nothing about C#, but I’m a programmer (web) and I know some of JS.

So… which way should I go?

Thanks!

c# is more powerfull and robust but javascript is good for small task. It’s more straightforward.

Right, and there’s some documentation on C#? Because the mostly I’ve seen is in JS.

And another thing, do you know any good tutorials besides reading the documentation?

Thanks.

First thing you should know is that it actually isn’t Javascript that you use in Unity. It is very similar to it but there are differences. I’m not sure of the specifics of it but if you stick with it be prepared for that. You might also hear it be called Unityscript just so you know if you ever hear it referenced.

On the wiki there is a page that talks about the differences between the two languages: http://www.unifycommunity.com/wiki/index.php?title=Csharp_Differences_from_JS

For me, I stick with C#. I develop in Visual Studio and it integrates perfectly with it and it is actually C# rather than a flavor of it. The skills you learn from it can be transferred to any other C# project.

Most of the tutorials you can find on Unity do teach in Unityscript though. It’s all personal preference because you basically can do the exact same in either language and they get compiled to the same exact intermediate language, but for the lowest learning curve I would say learn Unityscript.

I disagree with that completely.

Javascript (UnityScript) seems to be generally more popular with people who aren’t already familiar with C#. There are many more Javascript samples available, so it’s also more popular with people who are new to game programming or programming in general.

I personally prefer C# because I’ve been using the language since the first public beta, and because the Visual Studio support (integrated language, Intellisense, etc) is far superior to UnityScript. It’s also a more mature and well-designed language, in my opinion.

In the end, who cares what language it is? Pick one that seems most comfortable and go with it.

.

you disagree ? Yeah but you answer doesn’t pooint out in what you disagree. But a mature and well designed aren’t really similar to powerful and robust. I guess not but that’s not the point. Visual studio is indeed a really good argument I forgot about that one

Exactly.

C# is no more “powerful” then JS, they all compile the same. But if you choose Unity’s javascript, you’ll have to write a whole lot less code.

Yes, the JavaScript in Unity can perform all the commands and create code to do all the tasks you could do in C#. It may take more or less code depending on what you are doing. The language choice is really just a personal preference. Personally I am really bad at C and not so great at C++. I have been taught Java through 4 years of school, so I just use JavaScript. It is true that Unity JavaScript is not a true JavaScript from what I can remember when I learned some of it in a web development course a year ago, but it gets the job done and I can easily understand it.

Ironically, C# is much closer to Java than JavaScript is. And C# is (in my opinion) very removed from C/C++.

If you don’t have experience programming, if you want you can use JavaScript. But I guarantee you, if in the future you become more into programming and learn C#, you would never go back to JavaScript if you could avoid it.

Or conversely, if you’ve been programming for 30 years, and just want a language that allows for readable, succinct code, that will most likely do everything you need for game programming.

I must be the exception that proves the rule… I hated C#.

you dont actually gain much by using C# to program for unity - if we are talking generic programming language, then C is way more powerful, but when you step into Unity, theres not a big difference - whatever you are comfortable with

I’m a stickler for ultra type-safety, so C# fits extremely well with my coding behaviours and standards. So for me, such an explicitly typed language is very readable, whereas a very loose dynamically resolved language like JavaScript becomes very difficult for me to read. I just tend to assume that most high-end professional developers share that same opinion.

Boo is very nice once you get to know it. It’s not real similar to either language, but it’s not that hard to learn and the syntax is like python. And no semi-colens :smile:. I’m tired of typing them at the end of every line.

You can choose to use explicit typing in Unity’s JS. In fact, if you’re programming on the iPhone, you must use it.

Interestingly enough, all the “high end professional developers” I know have very different opinions, about everything from programming languages to pizza toppings.

Yeah, this fight will never end. Don´t listen to anybody, just make a project using all the languages available, and choose the one you feel more confortable with from that point on.

Just to be clear, by fight, i mean the general discussion: C# vs JS vs Boo; Unity vs any engine in C++; OpenGL vs DX. This will never end and, in the end, the only way to really know what is better (for you) is to try them all.

way to go and be all diplomatic and ruin the flaming - gosh :stuck_out_tongue:

I could probably count the number of times I’ve seen fully type-safe JavaScript on two hands. But that’s less of an issue of the language itself and more of a matter of the typical JavaScript developer mindset vs the typical C# developer mindset.

But yeah, we must end the flame war and the bazillionth C# vs JavaScript thread!

Agreed We’ll just say that C# is better and leave it at that :wink:

I am reading the book "Artificial Intelligence for Games " by Ian Milligton and John Funge
By the way, the best AI book I have ever read

AI algo’s are written in a pseudo code to allow readers to use their favourite programming language

However for a Unity user, C# should be the natural choice
Ok you can implement the same algo’s using JavaScript but it does not seem to be best solution

In other words, in my opinion
Generally speaking JavaScript and C# are equivalent languages but if you want to write a sophisticated gameplay C# is the way to go

What do you think ?