I’m a web designer so I already know JS (yep, I know that Unity uses UnityScript…). But I’d like to learn C# for personal purpose and I’ d like to kill two birds with a stone learning at the same time C# and Unity.
But there is one thing that stops me: I read around that most of the official tutorials uses JS, not C#. Is it true? (there’s a ton of documentation, so I haven’t personally checked)
It’s true. A lot of people coming into Unity are for the most part, people who haven’t coded before or who have come in with very little experience… and since the general idea is that UnityScript is easier to learn… well, you can see the train of thought.
There are some great tutorials out there that use C# - I ran across a series today on YouTube by searching with the C# tag after what I was looking for, Unity tutorial wise.
If you know js, just pick up a c# book, or some c# tutorials on the net, and go through them. Then just convert the js scripts, or some of them, for practice. There is very little difference because in the early part of the tutorials you are just calling Unity functions.
Unity documentation provides examples in JavaScript and C#, and Boo I think. Maybe some third party tutorials use more JavaScript, but C# isn’t at all that hard.
For some simple stuff you can start right away with C#, and probably is a little faster too.
this. There’s a dropdown in the upper left of the documentation that lets you switch between languages. There are also tons of C# tutorials out there for it and converting between the two is really pretty easy if you understand the basics of C#.
There are a few gotchas translating from JS to C# - mostly relating to type casting. C# is a stricter language with types. If you have some money I suggest the Scripting in C# for Unity tutorials on 3DMotive. I’ve just finished them and they really help out with the types problem.