- Home /
2 Programming Languages
Is it possible to use 2 Programming Languages in one game. For example would it be possible if some of my scripts were Java while others are c++. I am just wondering because I do not want to get to the point where I am fairly far long and the scripts clash together.
-Thanks in advance
Answer by robertbu · Feb 18, 2014 at 09:34 PM
Unity uses neither Java nor C++. It use C#, and a language referred to as Javascript that is really something else (and probably should be called Unityscript), and Boo. You can have multiple languages in a project, but sometimes you need to jump through hoops in order to call between scripts of different languages. It has to do with the order things are compiled. Lots of posts on the issue. It is easier to stick with a single language. There are a few more things you can do in C# that you cannot do in Javascript/Unityscript, but C# is a more cumbersome language to code in with more restrictions in how some things can be done (like coroutines).
Although, I would say that C# overall is a more flexible and powerful language than US. Would you agree?
Answer by Razputin · Feb 18, 2014 at 09:45 PM
You CAN do it, doesnt mean its a good idea tho. It usually doesnt end well from what i understand.
Answer by Yog0 · Feb 18, 2014 at 09:45 PM
It should be fine as long as you don't try to mix languages inside the same script, or try to call scripts externally that are a different language.
Answer by nightbane30 · Feb 18, 2014 at 09:45 PM
Yes, you may use different scripts with different languages. Although, the examples given in your question(Java and C++) may not be used with Unity. In Unity, you may use three languages; C#, Javascript(Unityscript), and Boo. You can use these different scripts in a single project, but I would recommend you not to, as it can become very confusing as to what function you programmed with what language, etc. It's confusing even just talking about it! :D
Your answer
Follow this Question
Related Questions
Any programs to practice javascript? 0 Answers
Loot code Modification 1 Answer
How would you go about creating footstep sounds? 0 Answers
Actual Programming Help 4 Answers
String segment comparator 1 Answer