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

Does Unity still support Unityscript / Javascript?

Discussion in 'Scripting' started by bigkahuna, Feb 14, 2019.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I found the blog post that explained that, starting with version 2017.2, Javascript support was being phased out but that *.js files would continue to be compiled. Will my *.js files continue to work? I have hundreds of files and it would be a major undertaking to rewrite all of them. Thanks.
     
  2. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,663
    My understanding is that you can't hit the "Create Script" button and select it anymore, but if you have js files, or create new ones, it will still compile them - this is gonna go away eventually though (if it hasn't already and I just didn't read about it) so my advice is do not depend on js files, and don't make new projects that use js. Your apparently a part of the dwindling 3 percent or so of projects that actually don't entirely depend on C# - and I strongly recommend you jump ship and start converting that code to C# because unityscript is done for.

    With that said, yeah just try and load the scripts up, they probably still work.
     
  3. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    There are a couple of websites which will convert unityscript to c# for you. I would recommend moving over to c# when you can.
     
  4. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,663
  5. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Thanks guys. I can only imagine how many errors I'll run into when trying to convert a couple hundred .js files to .cs. I've got 2017.1 installed and will try to make that work instead.
     
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Judging by the forum posts, actual compiler support for UnityScript was removed somewhere around 2018.3.

    Please please test this on a branch before committing to an upgrade, don't take my word on it.
     
    Daxawn and MD_Reptile like this.
  7. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,626
    If I were you, I would go even earlier with Unity version, to the point, where JS and C# were well supported. Then start conversion from there. And after moving to C#, upgrade to next stable Unity iteration. Then continue process, until Unity 2017 / 2018.

    This will ensure maximum compatibility, when converting / upgrading scripts.
     
  8. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,663
    I dunno - I'd just jump right into the latest version that supports it (of course keeping a back up/branch), then convert it all there in the latest editor where you can compare side by side if you need to for whatever reason.

    Tons of stuff is gonna need adjusting and slightly changed pretty much no matter what, but really it shouldn't be much more than 10-20 percent of the code or so that doesn't auto-convert cleanly.
     
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,229
    Yes. I thought it was mentioned in the release notes but I can't seem to find it right now. I do know it's mentioned at the very bottom of the upgrade guide.

    https://docs.unity3d.com/Manual/UpgradeGuide20183.html

    I recommend trying it out when you have the free time and seeing what happens. There are fewer differences between C# and UnityScript than people seem to realize. Fixing them is almost always trivial. If you get stuck on an error post it up here and we can show you what needs to be done to fix it.
     
    jhocking and Kiwasi like this.
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,626
    I see you point.
    But already between Unity 4.x, 5 and 2017 is massive gap.
    Is easier go step by step, than fixing forever 20% (guess) of code.
     
  11. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    813
    twobob and Ryiah like this.