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'

more ▼

asked Jun 28, 2010 at 02:54 AM

avatar image

372 79 62 76

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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".

more ▼

answered Jun 28, 2010 at 03:08 AM

avatar image

2.3k 63 61 88

Thank you. I am glad I explored that early, instead 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?

Jun 28, 2010 at 03:23 AM dingben
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Jun 28, 2010 at 03:47 AM

avatar image

116k 61 260 747

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Jun 28, 2010 at 02:54 AM

Seen: 2541 times

Last Updated: Jun 28, 2010 at 03:02 AM