- Home /
Different language scripts - how to avoid trouble?
Being absolutely new to Unity and relatively new to programming (past experience with ASP.NET in C# and no game programming beforehand), I find myself rather confused at this point.
I started developing a new game and decided I'd just get a hang of Unity at first. I made up my mind to use C# as a main programming language, but the Standard Assets you can import in default are written mostly in Javascript. Does this in any way cause trouble when creating your game? Being new to all of this, getting ready-to-go code and implementing it to see how it works is really helpful... I have no trouble understanding both Javascript and C# but I need to know if keeping scripts of both languages is gonna cause trouble in the future. Anyone can explain how these scripts affect each other?
That's incorrect, they can absolutely reference each other, you just have to obey the compile order.
Answer by sprawww · Mar 25, 2015 at 05:04 PM
No trouble. Keep your own code in C# whenever possible and you will be good. Unity will compile both Javascript/Unityscript as well as C# (...also Boo).
Only if you need the different languages to talk to each other, you may run into problems. The script that gets referenced has to be compiled first/earlier. You can check out the order here: http://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html
If you do not need any cross-referencing, there is no problem at all.
Sorry for the late reply - thanks a lot for your answer! Pretty much cleared up my suspicious.
Take care, A.