Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is Unity planning to kill JavaScript support?

Discussion in 'Scripting' started by gtapperdesign, May 10, 2016.

Thread Status:
Not open for further replies.
  1. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    Not easier to learn by any means. It depends on what background you come from. When I started Unity, I knew c# from my previous classes back in college. It is actually why I picked up Unity instead of another engine. And even before that I was use to using Visual Basics and working with Asp.net for webpages.
     
  2. Archemicus

    Archemicus

    Joined:
    Jul 22, 2017
    Posts:
    2
    Well, I looked a bit into C# and it's not that big of a deal as you guys said. But i was scared, and i'm still scared... What do i do with my 5000 lines of private plugins written in UnityScript that i always use for my projects?

    Will they still work? Do i have to rewrite those 5000 lines?

    This is what i don't want to happen, I could accept that C# is better than UnityScript, but please don't just throw away UnityScript and remove the compiler...

    Also sorry for my first post, i was scared because all of my code will not continue working... All those hours throwed away.

    And thanks for introducing me to C#.
     
    Bip901 likes this.
  3. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    They will work fine until UT starts obsoleting the language. For all we know at this point UT could decided to make a US>C# auto-converter. There isn't even an official post about it yet so you have plenty of time to start using C#, get competent and realize it's probably best to rewrite those plugins anyway. And as pointed out, even if they did remove it completely in a couple of years you could just version lock on the last supported version and finish your project.
     
  4. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Yes. Most likely they will keep whatever frozen level of UnityScript support remains for a long time before finally announcing a version that is C# only (and by that time they might have the proposed C++ equivalent too).

    Not yet, but I think it's a good idea. First, this is code that eventually needs upgrading anyway. Second, it's an excellent way to practice C#, translating your code like that. One class at a time. You don't have all those 5000 lines in one class, do you? ;)

    This has to happen eventually. At some point the compiler backend will advance so much that maintaining Boo/UnityScript support for it costs too much time and effort.
     
  5. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    This is something I'm sure I've seen them mention, actually. Conversion in that direction is far easier than the other, and the script converter already does a great job, so they have something to base it off. Speaking from experience, direct translation between language using the same API isn't even something that takes long to implement.
     
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,966
    No. Worst case if you migrate to the release that discontinues support your scripts will simply be non-functional.

    By the way @samnarain has a UnityScript-to-C# transpiler. You may want to talk to him to see if it's available.

    I have to disagree with this statement. Very little if any of the syntactical sugar provided by UnityScript truly hides anything of any real complexity and often by hiding it you're actually making life more difficult for the beginner because often C# will identify a problem that UnityScript simply ignores which often leads to unusual bugs a beginner can't track down.
     
  7. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    I strongly disagree, and here are the reasons why.

    1) More online resources. Besides Unity's own incredible tutorials (which exist for C# and not US), there are massive piles of C# tutorials in many places on the web. MSDN is an incredible resource for documentation. UnityScript tutorials are much fewer and farther between.

    2) More professional resources. For a number of reasons, virtually all pro and experienced Unity developers use C#. That means that the tutorials made for C# are much more likely to be coming from experienced professionals, rather than someone who has a month or two more experience than you do.

    3) More up-to-date resources. Because #2 has been the case for at least 5 years, a lot of the good tutorials that survive for UnityScript are 5+ years old. That's at least two major versions of Unity ago, and a LOT has changed in the engine since then. If you find a US tutorial on an arbitrary topic online, I would bet at least 50-50 odds that there will be some part of the tutorial that's no longer valid in the current Unity version.

    4) Better development tools. This is a consequence of C# being an actual programming language and not a marketing department lie, mostly, but the tools available in either MonoDevelop or Visual Studio - headlined by Intellisense and much better autocomplete but not limited to those - make it far easier to freely explore the language before you fully know it.
     
  8. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    What StarManta said. Stackoverflow.com alone is an invaluable resource for C# related questions.

    I'm not ashamed to say that over the past 7 years, 99% of the time I was stuck on a C# problem, I hit up Stackoverflow and became unstuck a couple of minutes later.

    Not only that, but with C# being actively supported by Microsoft, the compilers will only keep getting better over time.
     
    dagon likes this.
  9. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    Let's not forget all the new language features we just got access to in 2017.1, which will just plain never exist in UnityScript.
     
  10. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,649
    Whether or not we're going to do this (and if so, exactly how) is the main thing delaying an official blog post on the topic, FWIW.
     
  11. boxhallowed

    boxhallowed

    Joined:
    Mar 31, 2015
    Posts:
    513
    There's a few websites and an old extension that already does this.
    https://www.assetstore.unity3d.com/en/#!/content/176
     
  12. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,514
    I honestly don't think it's easier too learn. And this goes for both UnityScript and Javascript (though US is harder than JS, due to its niche status, and conflation with JS).

    My reason that I think it's harder is because it's bar of entry is so easy.

    JS is easy to get up and running with, hard to master.
    C# is a little hard to get up running with, but easier to master.

    Though I have used even easier languages as well, there are issues with C#.

    That's always been my beef with languages like JS. Sure I can do fairly simple tasks out the gate with it... but once my code needs to mature to any level, it all falls apart.

    It's why I LOVE TypeScript. If I have to write Javascript (real ecmascript JS), I will write TypeScript and "compile" that to Javascript.

    And that right there is sort of endemic of what is wrong with JS. JS is so prevalent because its ubiquity across the internet, and that low bar of entry keeps reasserting itself as the defacto standard on the internet. New devs pick it up real fast, but doing anything beyond basic animating or modifying some HTML, it's hard to do anything. So people created TypeScript to make it more viable in creating complex structures. That's how broken it is.

    But unfortunately we can't purge ourselves of it in the internet world. It is defacto.
     
    Ryiah likes this.
  13. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,649
  14. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    Oh oh, I smell an acquisition in progress!

    ;)
     
  15. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186
    hmm...maybe not at 3 stars. lol.
     
  16. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,966
  17. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,572
    I didn't really know any programming when I started with Unity (version 2.x). I used Javascript, mainly because the tutorials at the time were mostly in Javascript (Unity calls it Javascript in most places, so that is what I call it), now the tutorials are in C#, so I would probably start in C#. I have made the switch to C# because I licensed out a game and they required it in C# even though I had released it using JS. The transition was much simpler than I expected, so I moved my other projects for easier integrations with various SDKs. I mention this to show I have used both.

    On the whole, there is almost no difference in difficulty. Most of the changes are just syntax, saying things in a slightly different order.

    C# has a positive with it occasionally giving an error upfront where it might not appear until runtime in JS.

    JS allows you to call everything a Function. C# requires you to differentiate Functions from Coroutines (basically when you use Wait). JS is doing this anyway, it just does it for you.

    JS allows you to set one element of a Vector2 or Vector3 on an object. C# requires you to say all 3. I prefer the readability of JS on these occasions, but C# forced me to not set a .x then a .y of an object. JS is doing all 3 anyway, so setting one then the other means the program is doing twice as much work.

    As I said, there is almost no difference in difficulty. Mainly because they are so similar. Transferring to C or C++ from JS would be a much bigger step (I did start on C++, but more urgent things came up), do not mistake C# for those languages.

    It took me 4 days to learn C# and convert a whole released game. I didn't have that much experience programming at the time.
     
  18. KelsoMRK

    KelsoMRK

    Joined:
    Jul 18, 2010
    Posts:
    5,539
    Lol @superpig making one comment about maybe having an official blog post at some point in the future and it turning into acquisition speculation :)
     
    superpig likes this.
  19. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
  20. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Gather, children of the faithful!
    Open your eyes and C#
     
    Kiwasi, lordofduct, StarManta and 2 others like this.
  21. WhendricSo

    WhendricSo

    Joined:
    Jan 1, 2011
    Posts:
    171
    I fully support removal of "JS" from Unity. I run a local developer community meetup, and I get a lot of very confused people coming in, asking questions about JS and not understanding why I recommend using C#

    Ultimately, this seems to detract from their view of the engine, which is sad because honestly, Unity is a much better engine than Unreal or GM due to it's performance and flexibility, respectively. When UnityScript is removed, I won't need to explain to web developers why they can't just use their existing JS libraries to hack something together, and they won't be annoyed when they have to throw out all of their JS knowledge - they will just use C# because that's the scripting language supported.
     
    TaleOf4Gamers likes this.
  22. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    After a while in the frontend web development world I can safely say that isn't a big job.
     
  23. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well we can hope there will be a Sterling video on why C++ is better than C# and why C# is better than JS and why JS is US and not actually a country. We will surely need that glimmering light to usher us out of the darkness while providing much needed ad revenue.
     
  24. boxhallowed

    boxhallowed

    Joined:
    Mar 31, 2015
    Posts:
    513
    Pretty bitter eh?
     
  25. samnarain

    samnarain

    Joined:
    Jul 6, 2015
    Posts:
    99
    I do, I used Haxe and a hacked WebView for this purpose. There are however plenty of assets on the Asset Store that do this too, and some free regex based ones. I don't intend to throw it on Asset Store (I wouldn't be able to handle the support), and the only available UnityScript Atom package is rarely downloaded (I think a little over thousand). However it is an editor extension, not a all-in-wonder migration tool.

    Most likely Unity will provide a fancy updater or just drop "direct support" for creating scripts in the editor (like with Boo).

    There are three solutions to the questions here:

    1. Version lock your project to a version with UnityScript support.
    2. Migrate your project to C# and use visual scripting to overcome the scary parts. (I can recommend GameFlow).
    3. Write a transpiler and overcome the limitations of UnityScript at the same time. This repo is an excellent one to fork: https://github.com/bamboo/unityscript. The basic grammar for UnityScript can be found in the GH repo of my UnityScript Atom package here: https://github.com/samnarain/language-unityscript/blob/master/grammars/unityscript.cson

    I've made many times my case about keeping UnityScript support. But those efforts have been futile. So expect it to die, and its death to be announced through a blog post. I will mourn it, though.
     
    Last edited: Jul 27, 2017
    Ryiah and Kiwasi like this.
  26. CodeLiftSleep

    CodeLiftSleep

    Joined:
    Jul 15, 2017
    Posts:
    44
    No offense, but real programmers know about 6 or 7 languages, not just one. Learn C#, if you are a programmer it will take you a week maybe 10 days. I can program in javascript, including at least 3 or 4 frameworks, Python, VB.Net, C#, VBA, R, and I'm getting ready to learn C++(unfortunately---part of my Computer Science curriculum). Code is code, its mostly just learning syntax.
     
  27. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,966
    Qualifications for "real programmers" aside, since I don't feel like arguing over that sort of nonsense, Unity is used by far more people than just programmers. Being a programmer is merely one area out of many that can be covered by a game developer.
     
  28. Bip901

    Bip901

    Joined:
    May 18, 2017
    Posts:
    71
    So before you knew 6-7 languages you were not a "real" programmer? That's so wrong! You can know only 2-3 languages and still be a "real" programmer.
    Learning 7 languages takes time as well, you can't do that immediately! A lot of people are using Unity to learn, not just to program.
     
  29. samnarain

    samnarain

    Joined:
    Jul 6, 2015
    Posts:
    99
    Well said.
     
  30. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    ...who presumably don't care what language is going on under the hood?
     
  31. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Please explain how I have a full time programming job making serious-games knowing only one language.
     
    Martin_H, Ryiah and hippocoder like this.
  32. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    Clearly you're living in some sort of dream world :p

    A real programmer can pick up new languages as needed, but the job is what determines how many you actually need. In my day to day work I'm sticking to combinations of three languages at most, depending on the task. There's always a bit of JS for web-facing stuff, a bit of Go on the backend and often Bash scripts for all sorts of tasks whether I'm doing Go or Unity server stuff.

    I actually work with more configuration file "languages" than programming languages on a day to day basis :)
     
    passerbycmc and Ryiah like this.
  33. WhendricSo

    WhendricSo

    Joined:
    Jan 1, 2011
    Posts:
    171
    This thread has devolved into a flame war
     
    TaleOf4Gamers and JoeStrout like this.
  34. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    why would you even fight this point, 6 or 7 might be more than most need, but learning at least a couple of languages is highly beneficial. Learning your 2nd and 3rd language teaches you a lot actually and is not that big of task to do so. When you learn new languages you get to see how and why different languages and implementations solve the same problems in different ways and it really helps you grow as a developer.

    I also work at a job that is all Unity developer right now, and well it requires way more than just C#. I obviously use C# daily, but i also use C++, Obj-C, JS and Java for native libraries for the platforms we support as well and using python is general glue between tools in the pipeline and for scripting and integrating are content creation apps like maya and photoshop into the asset pipeline.
     
  35. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    I'm not fighting it, I literally haven't had a need to know more. With no demand, there's been no motivation. That's why that comment is so ridiculous.
     
  36. Dave-Carlile

    Dave-Carlile

    Joined:
    Sep 16, 2012
    Posts:
    967
    @LaneFox was addressing the claim that "real" programmers must know 6+ languages, not fighting anything.

    "Real" programmers know concepts. Programming languages are merely tools to implement those concepts, and which you use or how many you know is largely irrelevant.
     
    Martin_H, samnarain and orb like this.
  37. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    yeah was mostly trying to point out, is once you learn your 2nd language it helps you isolate those concepts, and understand them better knowing that different languages act as different viewpoints to that concept. Not saying it is required to know more than one, but i do believe you grow a lot as a programming once your learn your 2nd language.
     
    Martin_H likes this.
  38. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Move off the subject of how many languages you need to be pro because it's senseless and immature. Simple as that. Thanks. It's also wildly offtopic.
     
    Bip901 and samnarain like this.
  39. Bip901

    Bip901

    Joined:
    May 18, 2017
    Posts:
    71
    I agree!
     
  40. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,663
  41. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    STRING IT UP! BURN THE WITCH!

    Joking aside, it seems Unity's really thought this through. It would be quite enjoyable to be able to code in C++ alongside C# scripts without DLL faffery. One can hope :)

    In the meantime if beginners are such a concern perhaps lua really has purpose here as a bolt on? or visual scripting.
     
  42. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Or maybe even MiniScript? If people want to use it that way, I'm certainly game...

    (After writing the first three chapters of a Lua-based programming book for kids, I gave it up, and wouldn't wish Lua on anybody!)
     
    Dave-Carlile and hippocoder like this.
  43. keenanwoodall

    keenanwoodall

    Joined:
    May 30, 2014
    Posts:
    597
    Yes https://blogs.unity3d.com/2017/08/11/unityscripts-long-ride-off-into-the-sunset/
     
  44. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,294
    Thanks for contributing.
     
    KelsoMRK likes this.
  45. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    I love it! Ding dong, the witch is dead!

    I really appreciated the usage statistic they provided in the blog post, as well. It turns out I've actually been seriously overestimating the amount of people that use Javascript. I'd figured it was around 15-20%, where it's really closer to 4%.
     
  46. Denisowator

    Denisowator

    Joined:
    Apr 22, 2014
    Posts:
    918
  47. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well i got a few titles out of the door with js :) one of them with some boo. Good times. C# is OK but I still need glasses.
     
    Denisowator likes this.
  48. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    I must admit I'll miss it. In a weird sort of way.

    While I never actually wrote much with it, I did learn the language. And it was nice being one of the few people on the forums who could offer support for it. Even if I normally followed my answer with 'but C#'.

    Ultimately I think its a good direction for the engine to go.
     
  49. Kombiice

    Kombiice

    Joined:
    Jan 20, 2015
    Posts:
    64

    Oh. All the boo and Java(Unity, although .js)Script threads are beng commented on. Again.
     
  50. Kombiice

    Kombiice

    Joined:
    Jan 20, 2015
    Posts:
    64
    Hahahaha! Wonder how many people understood this :)
     
Thread Status:
Not open for further replies.