Hey guys what’s up? I code with javascript but understand well c#. I’m following the unity stealth tutorial and since it’s written in c# translating it into js is pretty hard. So I was wondering if I can use both languages simultaneously. Since unity works in both languages can it convert the scripts from one to another so they can both work together?
Well you can use them together, everything will work normally but you have to know which script you want to compile first.
A
lthough from my personal experience I prefer to use only one language (Preferably c#).
Unity doesn’t convert the scripts from one to another, however you can use this to convert from C# to unity-script.
Yes, you can absolutely use both simultaneously. The caveat is that if you’re going to communicate cross-language, you need the class you’re going to call to be compiled first. For example, if you have MyCS.cs and you want to call a method in MyJS.js, MyJS.js has to be compiled in an earlier step than MyCS.
You can get a list of the compilation steps here:
http://docs.unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html
It’s very easy to convert UnityScript to C#. Take a look at my answer on this question