Convertor scripts for Unity

You may know it, Unity allows to code in three scripting languages : C#, UnityScript and Boo.

C# is the language invented by Microsoft for it’s .Net framework, that’s why it is popular and powerful. UnityScript (US) is a language invented by the Unity’s developers. It’s syntax is close to the JavaScript’s (calling US “JavaScript” is a common mistake whereas it has nothing to do with ECMAScript for it is an overlay of Boo) and it’s syntactic shortcuts  makes it easy to learn and use so it is popular among the Unity community. The Boo is a .Net language with a Python-like syntax. Despite its lightweight syntax, it is by far the least used of the three language.

In order to gain experience, versatility but also by pure curiosity, I have the ambition to develop a version of my futures projects in each of these three language. But a manual conversion is all but practical. That’s why I begun a series of Unity extensions which aims to bring to their users a high quality mass conversion from a scripting language to another. Ie in practice that allows to convert dozens or even hundreds of scripts in a few seconds while keeping the manual conversion/fixing at a minimum (they are unfortunately unavoidable).

There is already two conversion scripts available on the AssetsStore, one that goes from C# to US, the other US to C#, but the quality of conversion is actually pretty low, leaving a lot of work to do by hand.

The first of my extension will convert from C# to US (that’s the easier way). The development already near it’s end with very good results, allowing for a release in July. The second extension will convert the other way, from US to C#. It is already fairly advanced but still need a lot more work. It turns out that properly converting US’s flexibility into C#’s strictness is not an easy task !

Extensions to convert from C# and US to Boo will also be developed (but Boo to C# or US won’t). All those extensions will be released on the AssetStore, at a low price.

This concept of script conversion can be pushed even further and allow -somehow- to code for Unity with a language it does not natively support. Indeed, it suffices that the conversion occurs whenever Unity regains focus. The user code in his favourite language, leaving to the extension do the job and convert to C# -for instance-, which is handled by Unity.

This concept will be put to the test by a first extension as proof-of-concept called JavaForUnity allowing to code in Java. I chose Java for this concept because its syntax is halfway between Boo and C # and that therefore the conversion itself is simple to perform. If this concept proves successful, I would look at LuaForUnty

More on all this when the first extension (C# to Unity) comes out. Stay Tuned !

Comments are closed