Java or Javascript?

Hi everybody,

I am very confused....

I have been learning Java for weeks now and I am starting to make first plans for my future game.

BUT then i read an article about Java where somone said that Java and Javascript are two completly diffrent languages ....and the cofusion began...

Then I opened Unity 3d and i saw Javascript and i had the feeling that all the work I have put into Java is nothing worth now.

So to come to a point What is Unity using, Java or Javascript? Or should I switch to C# to avoid confusion?

Note: I do not have a whole lot of scripting expierence and I am actually pretty new to all of this. (besides some Java) Sorry for my bad english. (English is not my first language XD)

Thanks

Javascript and Java are not closely related by any means, and unfortunately for you, Unity uses javascript. AFAIK (I wasn't even born yet) calling it javascript was just a marketing technique to make it more appealing.

If you think that you have a good understanding of Java, then C# will probably come easy to you. They are both strongly typed with similar syntactical rules. Not to mention that C# has more language features than javascript. But, Unity's implementation of Javascript is more class orientated than web javascript so if you are familiar with the principles of OOP then you will find that learning another object-oriented language won't be that hard if you do want to learn javascript.

I would suggest searching the forums and answers because there has been much debate over js or C#. More people use js, but C# has some more advanced features and the type safety makes it more difficult (not impossible) to write sloppy code. Either way though, you cannot write in Java, sorry.

java is completely different to javascript, common mistake.

Lucky for you though, that c# has pretty much identical basic syntax to java so just use that. Obviously a few language specific features but the fundamentals are near identical.

I would suggest using c# over javascript for unity anyway, even if you know both languages.

I made this mistake when I first started Unity as well. The other answers seem to have it covered, there are a few amusing answers on stack overflow for a similar question:

Java and Javascript are similar like Car and Carpet are similar.

  .

One is essentially a toy, designed for writing small pieces of code, and traditionally used and abused by inexperienced programmers.

The other is a scripting language for web browsers.

Taken from: http://stackoverflow.com/questions/245062/whats-the-difference-between-javascript-and-java

Unity uses javaScript(which is technically called UnityScript). Java and javaScript are two different languages. Don't feel bad though, I went through the same thing. I learned the JavaScript language for Unity and found it very easy to pick up and there's more documentation on javaScript in unity. Good Luck!