PDA

View Full Version : Javascript Vs. C# in Unity



Block Of Dirt
11-26-2015, 07:17 AM
I'm using Javascript to make a game on Unity but I hear people saying C# is better.
Could anyone list me the pros and cons of using each one? I'm not really sure if I should switch to C#

peck
11-26-2015, 07:24 AM
Javascript syntax and compiler for unity isn't as harsh, so it's great for beginners. However c# unity will work well in visual studio, supply "better"(better is stretched) functions and many tutorials I know stick to it. The manual will tell you the many key differences in function usage between the two.

Block Of Dirt
11-27-2015, 06:55 AM
Thanks for the reply, I think i'll stick to Javascript for the moment.

peck
11-30-2015, 12:14 AM
I would say it depends very much on your past experience. If your background is in C++ or Java, you will likely feel most at home in C# - however if you're experienced with dynamically typed languages such as JavaScript / Basic or PHP, chances are you will prefer JavaScript.

If you have no previous experience with programming - JavaScript might be an easier introduction - given that you do not need to worry about types and casting.

Do note that writing JavaScript in Unity is not the same as writing it for web browsers (which is why it is popularly nicknamed UnityScript in the community). You should check out the tutorials to familiarise yourself with it if this is the route you're going to take.

If you are planning to work with other programmers on a Unity project, I very much recommend that you decide from the beginning to work in the same language. While it is completely possible to combine scripts written in multiple languages into one project, you will very likely at some point run into issues due to the nature of the task of compiling and linking multiple languages.

Finally do notice that all documentation and tutorials for Unity are currently written in JavaScript and of the three available languages for Unity, only C# examples are given in the .NET documentation (since you are working with mono, you have full access to the mono port of the .NET library).

Remember to give credit to those you copy/paste off of!
http://answers.unity3d.com/questions/7528/how-should-i-decide-if-i-should-use-c-javascript-u.html

peck
12-07-2015, 02:12 PM
that user seems like a spambot

Maybe, but I have siggies disabled so I wouldn't know of any click bait of sorts. Maybe it's a foreigner of common language doing the usual weird stuff. Who knows.

Blocko
12-08-2015, 05:00 PM
I'm using Javascript to make a game on Unity but I hear people saying C# is better.
Could anyone list me the pros and cons of using each one? I'm not really sure if I should switch to C#

Okay, so c# isn't better if you use java but it's easier to learn that's why many peoples use it, im using c# too :D but it's only wasting time to you try figure it out. Use java if you are good at it.