What is the best script language for Unity3D

zanona picture zanona · Feb 26, 2012 · Viewed 18.8k times · Source

I am starting with game dev using Unity3d and I can see there's 3 supported languages for creating scripts: C#, unityscript and Boo...

although, coming from a web-design past I am obviously used with javascript, but after few attempts I could notice Unity3d doesn't really have full support to the script language and some elements like new Date().valueOf() and some other statements within methods such as the attribute arguments and many other won't work properly, also it seems my file can't have a wrapper method that envolves all the other methods like:

(function (scope) {
    function Start() {
        ...
    }
    ...
}(this));

and when using something like new Date().valueOf() which is valid in JS I get:

MissingMethodException: Method not found: 'System.DateTime.valueOf'. Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()

So perhaps the compiler turns that initial 'unityscript' code into Boo language? so perhaps Boo is the right 'native' choice and maybe unityscript itself isn't the best way to go when developing unity3d apps?

I was thinking on a language that has full support to all known native classes and methods which will work without problem?

Sorry for any errors mentioned above and please let me know what you think.

Answer

pland picture pland · Feb 26, 2012

Unity doesn't use 'real' Javascript per se. See:

http://forum.unity3d.com/threads/1117-Javascript-Version

UnityScript is based on javascript 2.0. There are a few things missing (switch statements, etc.), but they get half the speed of C++, which is way faster than Mozilla.

Once you get used to it, developing in 'JS' for unity is very very fast and flexible...but of course, if you're going to develop native components, or interface to anything in C, you'll need to use C# (in the end, C# is not difficult to learn).