If my end goal is to create awesome WebGL applications for the web…is it best practice to write all code in JavaScript vs C or C#? Meaning, will doing so rely less on the compiler converting my code for me? I am an amateur programmer for Unity, but want to really spend the next year learning a language for Unity scripting. Before I chose one I want to research the best language for me as I know WebGL is my ultimate end product - my clients do not want to install plugins to run their applications we create.
C# or UnityScript both get translated to C++ and then Javascript for Unity’s WebGL build target. You can use whichever one you are comfortable with but UnityScript(what you are calling JavaScript) is not real JavaScript and it is going to begin to look even less like real JavaScript soon with ES6 around the corner.
My recommendation would be C#, it seems to have the bulk of the examples these days and recommended going forward by some Unity staff on these forums.
Thanks Tiggus! So I guess there is no way around the long compiler conversion process then. When working on WebGL projects is sure gets old waiting 15 min for the build to compile so you can see what it will really look like in WebGL.
But based on your note, and everything I see - sounds like C# is the way to go. Thanks for the quick response!
Yeah the current build time is pretty nasty for WebGL, but hopefully they find a way to speed it up. Make sure you’re using the fast build options they list in the player options which results in larger code but faster build when just testing. Still pretty slow though.
The long compile process is due to the 17 (or so) different languages that the compiler goes through in between these steps, and the massive optimisation it does. I would expect it to get better as time goes on.
Yes, I hope so. I see WebGL as the main deliverable for most our projects moving forward. I hope Unity focuses on this feature in coming versions…but doesn’t look like it got too much attention in 5.1