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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

C# or Javascript?

Discussion in 'WebGL' started by Caphalem, Sep 22, 2015.

  1. Caphalem

    Caphalem

    Joined:
    Sep 11, 2015
    Posts:
    5
    WebGL is a Javascript API and so when Unity builds a WebGL project it translates your code to Javascript. When we're writing scripts we have a choice of either writing them in C# or Javascript.
    My question is: if I am planning on making a game for the WebGL platform wouldn't it be better for me to code the scripts in Javascript opposed to C# or does it make little to no difference in the end result?
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    There is no advantage in using js, because the scripts need to be converted anyway: C#/JS => Intermediate Language => Native C/C++ => LLVM bitcode => Javascript
     
    Caphalem likes this.
  3. Caphalem

    Caphalem

    Joined:
    Sep 11, 2015
    Posts:
    5
    Oh... Totally forgot about the Native C/C++ part lol. Thanks!
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Also Unityscript isn't Javascript anyway. It may be called that in the docs, but it's a very different language (which is why it's referred to as Unityscript around here).

    --Eric