UnityScript to C# Conversion Tool
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.
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:
- Support for preserving comments from original scripts
- Introduced an Editor Integration Package to simplify usage
- Improved support for a number of UnityScript constructs
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:
- Backup your project
- Open project in 2018.1
- Accept API Updater offer (if any) and fix remaining errors
- Make sure player builds successfully on each target platform
- Make sure all related tests are passing (also, run the project on real devices)
- Install the latest Editor Integration Package (see here for instructions on how to install asset packages in the Editor).
- Clean editor console
- Run the conversion tool.
- Fix any remaining issues (running related tests)
|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.
12 ComentariosSubscribirse a los comentarios
Ya no se aceptan más comentarios.