Skip to content Skip to sidebar Skip to footer

UnityScript Vs Javascript

I know there's a difference between the languages, such as classes etc. What I wonder is this: If UnityScript is different from Javascript, why does the Unity3D documentation giv

Solution 1:

Unity uses a custom JavaScript variant also known as UnityScript which it historically and still today commonly (but inconsistently) refers to as "JavaScript," including as you note in its own script documentation.

This is incorrect in terms of the meaning of the term "JavaScript" in the programming world at large (i.e. beyond the Unity community). UnityScript is definitely not JavaScript. They are incompatible languages with fundamental differences. From a strict correctness point of view, yes, Unity should use "UnityScript" in its documentation.

The incorrect usage doesn't tend to be problem within the Unity community, within which it is assumed that "JavaScript" means the JavaScript used by Unity. In fact, it's possible that using the term "UnityScript" could cause confusion within the Unity community, because the term "JavaScript" has historically been and continues to be more commonly used, and it's possible many non-programmers within the Unity community don't even realize Unity is actually using a variant JavaScript, as opposed to actual JavaScript.

However, outside of the Unity community, including here on Stack Overflow, using the term "JavaScript" to mean anything other than the actual JavaScript will cause confusion, which is why it's important to say "UnityScript" here.

Incidentally, Unity adds to the potential confusion, both within and without the Unity community, by not being consistent. In its release notes for version 5, it used both "JavaScript" and "UnityScript" interchangeably. In a blog entry about an important scripting change, it used the term "UnityScript-aka-Javascript."


Solution 2:

Quote from Juhana, thank you for the answer.

JS and US have enough differences that it's important to distinguish between them when you ask a question. Otherwise you might just waste people's time when their answer is incompatible with what you're actually using. On Unity's site on the other hand there's no danger of confusion because it's obvious from the context that they're always talking about Unity and never about non-Unity JavaScript.


Post a Comment for "UnityScript Vs Javascript"