Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Programming

Discussion in 'Scripting' started by thinkablegamer, Mar 14, 2015.

  1. thinkablegamer

    thinkablegamer

    Joined:
    May 18, 2014
    Posts:
    1
    so i am kinda new to unity scripting and i just want to know if unity supports normal javascript or so i have to learn the java that comes with unity?
     
  2. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    It dosnt support proper javascript, it supports C# and its own varient of ecmascript.
     
  3. toreau

    toreau

    Joined:
    Feb 8, 2014
    Posts:
    204
  4. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    In short: It's only JavaScript syntax. Though the same is true for C# - it still uses mostly Unity's own scripting commands. If you are experienced in either language the transition shouldn't be too painful, though.
    Also C# has become the main syntax used in most Assets and projects (~60% as stated in another thread).

    Just look through a few tutorials and give it a go. :)
     
  5. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,377
    Ehhh... no.

    It uses C# the language. It's straight up C#. Of course there is the unity's api so you can program against it, but that's like writing against any 3rd party api. It doesn't mean its a variant of the language. This is why you can just download straight C#/.net libraries from the internet and they 'just work' (as long as they access Mono 2.6 and earlier... which is about .Net 3.5 or so).

    Where as unityscript IS a variant of javascript. Because it has syntactical differences from real javascript. Javascript does not contain a yield command, nor a class command (javascript technically doesn't have classes, it uses the prototype design to create object identity). Furthermore, unityscript compiles into CIL, where as javascript is an interpreted language that doesn't get compiled.
     
  6. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,739
    Really wish UT would explain the differens better and rename JavaScript to UnityScript. Way to much confusion is caused by this simple issue.
     
  7. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    Ehhhh... thanks for clarifying ;)