Jump to content
  • Advertisement
Sign in to follow this  
CGXel

Unity - Script Languages

This topic is 1377 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've heard that Javascript is the easiest of the languages that Unity supports, but I was wondering what are the differences between (for example) using Javascript besides C#?, what are the pros and cons?, or does Javascript isn't able to do some task that C# does?

 

Please explain :)  thank you in advance

Share this post


Link to post
Share on other sites
Advertisement
Unity lets you use Unityscript, which *looks* like Javascript, but is not.

Unity also lets you use C#, which is *actual* C# and not a special interpretation of it.


Beware of people that tell you that a particular language is "easy". When people say "easy" when talking about programming, they *usually* mean "easy to throw code together without thinking about writing good code" and not "easy to write good code and maintain large games".

Share this post


Link to post
Share on other sites

Beware of people that tell you that a particular language is "easy". When people say "easy" when talking about programming, they *usually* mean "easy to throw code together without thinking about writing good code" and not "easy to write good code and maintain large games".

So basically... C# its better?

Share this post


Link to post
Share on other sites

 

Beware of people that tell you that a particular language is "easy". When people say "easy" when talking about programming, they *usually* mean "easy to throw code together without thinking about writing good code" and not "easy to write good code and maintain large games".

So basically... C# its better?

 

It will serve you better in the long run. Most Unity developers use c#, and by most I mean 90% or so. Plus it's a general purpose language that runs managed or native(vs 2015 .net native/IL2CPP), so you could also use it outside of Unity for anything.

 

Also since you are starting out you should watch these videos or else.

http://unity3d.com/learn/tutorials/modules/beginner/your-first-game

Edited by EddieV223

Share this post


Link to post
Share on other sites

I've used both C# and Unityscript (and even a little Boo, which is a Python-like language in the same way that Unityscript is Javascript-like), and it's very evident that C# is the correct choice. It's better supported, the documentation is better, and it has fewer strane performance quirks.

 

TL;DR? Use C#.

Share this post


Link to post
Share on other sites

Just to add my two cents (I also much prefer C# to UnityScript and Boo, by the way): when learning C#, do not underestimate the importance of having a strong understanding of Object Oriented Programming and (arguably to a lesser degree) the .NET framework as a foundation.  This can be the difference between "knowing" and "knowing enough to be dangerous".

 

Happy learning!

Share this post


Link to post
Share on other sites

+1 to C#...

You can use proper OO Concepts with it... that will help you become a better programmer for many popular languages like Java or C++ also. Whil you will not become a Java expert from using C#, getting your head wrapped around the concept of OO usually is the biggest bump at the beginning learning any OO language, so it will be much easier learning a new OO language in the future (also seeing how much Java, C# and C++ share in other concepts and syntax because of their common roots).

 

One thing to keep in mind is that OO programming sometimes clashes with the Component based architecture of Unity. Unity wants to enforce you using Components, which can sometimes make it hard using proper OO Concepts.

For example, you cannot call a Constructor on a Monobehaviour, if you need to hand parameters to it at start time, you need to come up with some Init() method that you call just after instantiation of the prefab containing the behaviour or adding the behaviour to an existing gameObject. It isn't really a problem, but it breaks with OO Concepts enough to be a nuisance.

And as an OO programmer, you sometimes have the habit of creating your non behaviour classes (like small helper classes that do not need to be called by the engine) as proper OO classes, which can then lead to jarring code, where first a Monobehaviour is instanciated with Unity's own method and feed with data over an Init() method, while the helper class just below is properly instantiated with a normal C# constructor.

 

That doesn't make Unityscript the better choice though, at least IMO. Just keep in mind that Unity is not REALLY using a proper OO model for its own system, and C# code from other sources might not always work without proper conversion because of that. 

Share this post


Link to post
Share on other sites

Neither of the languages is easier or better than the other.  In the context of Unity they both do the same thing.  One may have a little syntactic sugar here and there whilst another may have some built in containers or utillities.

One thing you will find though like has already been mentioned above is that nearly everybody uses C# in Unity so if you look up a tutorial it will be in C#.  If you download something from the asset store and want to fix it then it will be in C#.

Share this post


Link to post
Share on other sites

do not underestimate the importance of having a strong understanding of Object Oriented Programming and (arguably to a lesser degree) the .NET framework as a foundation.

 

I'm watching a video about OOP to understand what's that :)   (still have no idea what's .NET Framework)
 

+1 to C#...

You seem to know about this :)   (OO = OOP?,  Object Oriented Programing?), I'll note all you said and give it another read when I have a proper understanding of this subject, because at the moment I'm having a hard time understanding all that, but thanks again!, any useful information is always welcome
 

Neither of the languages is easier or better than the other.
One thing you will find though like has already been mentioned above is that nearly everybody uses C# in Unity so if you look up a tutorial it will be in C#.

Interesting :)  Yea, so I guess if I do my code with C# and ran into a problem I could easily find help since most people uses it

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!