Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
2
Question by Divole · Sep 21, 2015 at 06:58 AM · exportinglanguage-comparison

Nonsyntactical difference betwee C# and Javascript

I was wondering if the choice between using Javascript or C# would affect somehow the outcome of the project. Javascript is more web technology therefore I was thinking at first that if project is a web game, then it is better to chose Javascript over C#. On the other hand Unity web player probably converts both C# and Javascript into bytecode, so maybe there is no difference which one to use. Please correct me if I am saying something wrong here.

Then the question is, what if I make a mobile game (or a game for some other platform) - does it make a differnce if I chose Javascript over C#? In general I want to figure out, If the language can affect the outcome and when you - experienced people, would chose one over another?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Xephex · Sep 21, 2015 at 06:04 PM 0
Share

I too would like to know the answer to this question.

avatar image Dave-Carlile · Sep 23, 2015 at 01:08 PM 0
Share

The forums are probably a better, um, forum for this discussion. But my understanding is that the language isn't relevant since it all compiles down to the $$anonymous$$ono implementation of .NET.

That said, Unity Script isn't Java Script. It's close, but there are differences. C# is the better language, but that's a statement of faith and the religious discussions should happen somewhere else :)

avatar image RybiconZX · Apr 14, 2016 at 03:28 AM 0
Share

@Divole I think it all comes down to your personal preference because like @Dave Carlile says it all gets converted anyways. Personally do web development professionally so I'm use to JavaScript but whenever I see JavaScript in Unity it really hurts my brain so I prefer C#. I'd also say C# is the way to go because the majority of tutorials are in C#, a welcomed change from a few years back when it seemed like most tutorials were JavaScript spaghetti code.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Immanuel-Scholz · Apr 14, 2016 at 09:49 AM

Both languages get compiled into IL code (otherwise known as ".NET binary dll's") by the mono.exe compiler (not the web player).

If you target IL2CPP, the IL code gets further mangled into CPP. If you target WebGL, this CPP code is then converted into JavaScript.

This happens long before any player later sees the code. There is literally not a single line of C# or UnityScript code present in the final game anymore - even if the end-product is JavaScript again. (Note: That is not true for *.jslib assets containing JavaScript for the browser. These are always plain JavaScript and have nothing to do with "UnitScript vs. C#" decissions. Except for my second point below)

So from that point of view, it does not matter. In fact, you can use any language that compiles to a IL binary. Boo, VisualBasic, F#, IronPython, BrainFuck, whatever..

That said, there could still be reasons to choose the one language before the other:

  • If you are firm in one of the languages, choose this one.

  • If you have tons of JavaScript/C# code at some other place (e.g. a server running JavaScript/ASP) then it might be wise to use the same language in the client, so its easier for you to share some small pieces of code (like data structure definitions or some Unity-independend helper classes / libraries).

  • UnityScript is an order of magnitude slower to compile than C#. So you might not use it solely in a project with 100k lines of code.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

32 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Export Multiple Scenes 0 Answers

Import Unity project in already built Android Project 0 Answers

Can I include a Mono DLL and a native iOS static library in a Unity Plugin? 1 Answer

Can't export to windows build but can on linux 0 Answers

Blender to unity different color 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges