Do you have any older projects that use UnityScript? If so, you might be interested in our open source UnityScript to C# conversion tool available to download now.
Back in August 2017, we have begun the deprecation process for UnityScript, a JavaScript-like scripting language, and started working on a conversion tool from that language to C#. Shortly after that, we moved the menu option used to create new UnityScript scripts under Legacy.
Since then we’ve collected a lot of feedback and fixed a bunch of issues in the conversion tool. To name a few changes motivated by your feedback:
With Unity 2018.2, we removed the option to create new UnityScript scripts completely. Now we believe that the conversion tool is feature complete and stable enough to help any of you that still have projects using UnityScript.
Before starting the conversion process, we suggest that you make sure your project builds cleanly on Unity 2018.1, all of your tests are passing and you understand the limitations listed here.
We recommend running the conversion tool through the menu Tools/Convert UnityScript to C#. If you need more control over the parameters used during the conversion you can run the conversion through the command line but keep in mind that the extra flexibility comes with extra complexity.
As an example, the video below outlines the process of converting an older version of Angry Bots project. The intent of this is only for demonstration purposes whence we simply commented out any code causing compilation errors when first open the project in 2018.1.
To summarize, the basic process should be something like:
Note that if your project targets multiple platforms, you may need to repeat step 8 for each target platform by selecting the platform before running the conversion tool, and then manually merge the converted code, wrapping the code with conditional code accordingly. This is a limitation of the tool. In this case, you’ll probably use a VCS to restore the state of the project after each conversion. |
Step 9 may or may not be required (it depends on which APIs your project uses), but in the Angry Bots example, we needed to fix some API usages.
Since the tool is open source, you’re invited to download its source and look around! Please feel free to contribute any fixes/improvements.
If for any reason this tool does not fit your needs you may want to check other converters available on the Asset Store.
Finally, if you need any help with the tool please ask in this forum thread and we’ll do our best to help you.