Can JavaScript be expressly used to develop Unity games?

北城以北 提交于 2020-02-13 12:58:26

问题


I would like an authoritative answer on a point that has been a question mark for me for a little while. There seems to be a frequent use of the term JavaScript to mean or describe UnityScript.

I have been told time and again that you can use actual JavaScript to develop games in Unity, however from what I understand UnityScript could, at best, be described as a superset of JavaScript, but there really are some items that perhaps aren't completely compatible and you can't simply use JS as you normally would to develop Unity games as you would have to follow their conventions.

Am I wrong about this? Can you actually use pure JS and its conventions directly to make Unity games outside of following the parameters that UnityScript has set?


回答1:


Short answer: No you cannot use PURE JavaScript. As far an I am aware - Unity uses it's own JS-like syntax (some people refer to it as Unity JS) but it is most commonly known as UnityScript.

Your question arises from the fact that the Unity community refers to JavaScript and UnityScript as if they are equivalent and interchangeable.

Whilst these look and feel extremely similar - there are some fundamental differences such as UnityScript being class-based whilst JavaScript doesn't support classes.

You can definitely use prior JavaScripting conventions you have picked up within UnityScript as a LOT of it applies. The semantics used are a little different - but I've found it doesn't take long to pick up on the small changes.

Read more about it here: UnityScript versus JavaScript

Happy coding!



来源:https://stackoverflow.com/questions/27809074/can-javascript-be-expressly-used-to-develop-unity-games

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!