- Home /
DIFFERENCES between (true)javascript and Unityjavascript - prototyping
I would hope that all the references in the documentation that state 'javascript' are updated to be 'Unityjavascript'. It should really be 'UnityScript'.
This post is a result of the issue over global variables at: [http://answers.unity3d.com/questions/13717/global-variables-static-keyword][1]
........... Note from above post. If only ECMA-ish then not the same, thus problems. geees... I was afraid you would say that... now I have to dig into a new reference set to see if what I attempt to code using my (true)javascript understanding will fly in this version. Before I start digging, can you tell me if classes in Unityjavascript are attained the same way as in (true)javascript by nesting functions/prototyping? ... and are closures also a way of life in Unityjavascript? I am going to start a thread for 'DIFFERENCES between (true)javascript and Unityjavascript'. ...........
THUS FIRST QUESTION: how does UnityScript handle classes... as a prototyping engine or a class engine as C#, C, etc..
The next post would be 'closures'
Answer by dhendrix · Jun 28, 2010 at 03:08 AM
There are really far too many differences between the two to even acknowledge imho. It really is just better to treat it as another language entirely.
You should really compare it more to C# actually. And when using documentation outside of the Unity websites, you should stick to MSDN since it is based on the mono framework.
EDIT : This question may be of interest if you haven't seen it yet. It discusses differences between C# and Unity's "Javascript".
Thank you. I am glad I explored that early, ins$$anonymous$$d of banging my head at the unknown. I don't know C#, but I am able to read much of it. I seems I will now get acquainted with C# more than expected, even though I will be doing my code in javascript?Unityjavascript?Unityscript?
Answer by Eric5h5 · Jun 28, 2010 at 03:47 AM
Javascript in Unity is very similar to JScript.NET. Here is a comparison of prototype functions from Javascript/JScript, compared to how you use classes in UnityScript/JScript.NET. It looks like all the JScript.NET code on that page will run as-is with no changes in Unity.
Your answer
Follow this Question
Related Questions
Is there a performance difference between Unity's Javascript and C#? 6 Answers
Script translation 2 Answers
Can I declare properties in JS? 1 Answer
How should I decide if I should use C#, JavaScript (UnityScript) or Boo for my project? 14 Answers
Can I use lambda expressions or anonymous methods in JS? 1 Answer