Javascript v C#?

I’ve been using Unity for a long time now, but I’ve only ever used javascript, because it seems easier to me. Is there any adavantage to using one over the other?

Not really a huge difference. But if you really want to know you should search the forums. This has bin discussed many times before.

Yeah there is numerous topic on the subject, that is really a matter of preference and your previous background with language

The only difference is that C# is easier.

And documented with several hundred thousands of pages of documentations, tutorials and books

Well from a newb sight, the most examples and tutorials on unity i find, are on JavaScript So are most of the post when i search for a problem.
Also i find Java much easier to use in unity then C#, no weird declarations at the beginning, just start and code. Not having to worry about a thing :).
But thats me.

That’s really weird, because Java isn’t used in Unity.

  1. Unity does neither use nor support java at all
  2. UnityScript is not the same thing as ‘javascript’ on which you find tons of material which has nothing to do with unity at all nor is it compatible with unity commonly. its about web JS which is completely seperate from Unitys UnityScript

Uh oh, im sorry about that mistake! :frowning:
on your second point, I was pointing to the examples and tutorials on the forums. or on youtube (which are all unity related) so i actually meant to say that most of the tutorials i find are UnityScript based? (is this right? if not, please correct my mistake!)

there are quite a few tutorials etc thats right. But you have to realized that UnityScript exists here and here only.
C#*is a world wide standard used in countless places by potentially hundreds of thousands to millions of programmers every day for their day job, not just by several thousands perhaps several ten thousand users fulltime. As such its just natural that the amount of documentation and tutorials you will find can’t compete.

That does not make UnityScript a bad language. But it means that if you don’t know how something might work, or when its the only language you know, you can get into serious trouble due to the lack of language documentation itself already and the ‘good guess’ state of knowledge on how some stuff works or does not work, changing constantly too (3.4 broke different things).
Also learning C# is a good idea for a second reason: the .NET documentation does not exist for UnityScript and will never, but it exists in C#

Most who claim that UnityScript is simpler than C# just never realized that its not Unity 2 anymore,t hat Unity 3 runs on C# 3.5 which changed the field completely.

why did that change the field completely? Does that mean that c# is supposed to be even simpler?

It changed completely because the largest benefit UnityScript programmers claim to have vs C# is the variable data type, that you don’t have to type in all that stuff, yet since Unity 3.0, Unity has the variable datatype on C# too.

Also with the UnityScript compiler getting fixed step by step, part of the ‘simplicity’ is going away and has gone away already, its approaching C# more and more. Lets face it, UT cloned generics including the syntax, and thats not for no reason.

yeah what do you mean by changed the field completely in unity3.5? do mean that the declaration or the syntax will be the same as c#.net?

I think dreamora means the implicit allocations.

In C# specifications below 3.5,

var someVariable = 5;

is not valid, where from 3.5 and onwards it is. If you use the ‘var’ type, the compiler just guesses what variable type you want.