7 Unity Game Development Languages to Learn: Which Is Best?
Whatsapp Pinterest
Advertisement

Developing games has never been easier. Game development platforms like Unity make it possible to create everything from simple 2D platformers to fully detailed 3D first-person shooters. Unity is free to small developers, and there is a wealth of tutorials on how best to use the editor to prototype your ideas.

Learning how to use the Unity program will only get you so far. The real core of your game will be the code that determines its behavior. Working out which language to learn for game development can be hard—but in the case of Unity, it’s simple.

1. The Best Choice: C#

For anyone starting with Unity, or anyone with previous knowledge of object-oriented programming, C# is the right language to learn for Unity. In fact, C# is the only language worth learning for the platform, and with good reason.

Unity uses Mono, which is a cross-platform implementation of Microsoft’s .NET framework. C# is the primary language of .NET, and all of Unity’s libraries are built using C# code. To say that C# is the language of Unity would not be an exaggeration. Unity has made it clear that they consider C# to be the only language for use with the engine going forward.

This is good news, as C# is a powerful language and easy to learn. Unity is just one of many good reasons to learn C# 7 Practical Reasons to Learn C# Programming 7 Practical Reasons to Learn C# Programming There are many programming languages, so which one should you choose one to learn? Here are several reasons to learn C#. Read More , and if you are a beginner, you may even find it more accessible. Developing games gives structure to learning, and project-based goals lead to greater understanding of new subjects.

With the introduction of the C# job system and ECS, Unity is pushing what can be done with C# further and further, and the new Burst compiler make it faster than ever before.

2. The Current Alternative: JavaScript

Unity also supports JavaScript—known as UnityScript. Since release, JavaScript has sat side-by-side with C# as a fully featured Unity development language. The Unity scripting reference had example code in both C# and JavaScript for most elements of the library.

This was useful for developers coming from a JavaScript background as despite differences in the way code was structured they could use familiar syntax. There was, however, a problem.

While UnityScript seems similar to JavaScript—it’s not. UnityScript has classes, something which JavaScript doesn’t. Features of JavaScript like multiple variable declaration and optional semi-colons are not available in UnityScript.

Perhaps crucially, searching for JavaScript help on Unity projects has always caused confusion as most people referred to it as JavaScript rather than UnityScript. Results for both web design and game development blurred together, and the difference between the languages was a point of contention to pure JavaScript developers.

Perhaps unsurprisingly, Unity announced they were going to withdraw support for UnityScript, and there is now a timeline in place to decommission it. You can still use JavaScript with Unity, but knowing it’s going to come to an end, why would you?

3. The Old Third Choice: Boo

In the early days of Unity, there was the option of using Boo—a Python-like language. This is perhaps unsurprising as Rodrigo B. De Oliveira, Boo’s designer, worked for Unity. The language is compatible with .NET and Mono and would be fully implemented with the game engine. What went wrong?

Not enough people used it, likely assuming it was merely trying to imitate Python. Over time, Unity dropped support for Boo, and the upcoming changes to UnityScript will render all old Boo scripts useless in Unity. Some might see this as a missed opportunity, as Boo was a great attempt at Python-like syntax for .NET programming.

Lovers of Python do have another option, however.

4. The Odd Choice: IronPython

If you want to develop games, Python is probably not the language for you 4 Reasons Why Python Isn't the Programming Language for You 4 Reasons Why Python Isn't the Programming Language for You The Python programming language is extremely popular, but here are a few reasons why you might want to avoid Python. Read More , but it is possible. In his Microsoft Developer Community blog, Charlie Calvert outlines how to run Python from C#— but it’s not for the faint-hearted. Almost ten years later, IronPython is still in active development.

In short, you will need to download the IronPython libraries from GitHub and reference them in your C# project. This will allow you to call Python scripts from C# scripts much like you would any other library. IronPython also allows for calling .NET libraries from Python. As useful as this sounds, since Unity relies on C# this functionality doesn’t help.

IronPython—and IronRuby, it’s sister project linking C# with the Ruby programming language—are fantastic projects, but they aren’t practical for use with Unity.

5. The Interesting Choice: Lua

One of the better implementations of an external language for Unity is MoonSharp—a Lua interpreter. This project isn’t designed to replace C# as a language, more act as a bridge. The perfect use case for MoonSharp would be to add in a way for players of your game to create game mods in the Lua language.

You could also use it to describe objects and design levels separately from your core game code.

If you are already coding in C# and looking for an interesting way to interface with your code, MoonSharp is worth consideration. Since it is available for free on Unity’s Asset store, you can import it directly into your projects.

6. Best Language for Plugins: C/C++

Despite the robust Unity library and all the available tools C# gives, sometimes you may want your own plugins. The main reasons people opt for plugins include speed, or access to a codebase already written in another language. Building these scripts into DLL plugins saves remaking code and can improve performance in some cases.

In most cases, C++ will be the language used for plugin creation, but C would work equally well. So long as the code builds into a DLL, it can be placed in Unity’s plugin folder and referenced in code. The likelihood is, however, if you are already comfortable coding in C/C++, that learning C# would be a relatively simple task!

7. New Language for Plugins: Rust

Rust is a language with a lot of buzz around it. Experienced programmers love it for the incredible amount of control it gives while avoiding the pitfalls of writing in less safe languages like C++. Rust was created by Mozilla in 2009, as a way for developers to develop high-performance software quickly.

While it isn’t possible to write Rust in Unity directly, you can access functions and methods written in Rust from your Unity code. Jim Fleming covers how to do it in detail in his post on Medium.

If this seems familiar, it’s because this is another way to create Native Plugins. By leveraging Rust’s ability to interface with other languages, you can call Rust functions directly from C# code using Unity’s DllImport attribute. Naturally, there are several steps in between, and reading Jim’s follow up post along with gaining a good understanding of FFIs (foreign function interfaces) is advised!

A Simple Choice

Unity’s attitude to any language that isn’t C# is clear, and the constant improvements to Unity rely on this single-mindedness. Couple this with Microsoft’s continued improvement of C# as a language, and learning C# for Unity game development is a no-brainer. And be sure to check out Unity Learn for an easier way to learn game development Unity Learn Is the Easiest Way to Master Game Development Unity Learn Is the Easiest Way to Master Game Development Want to start developing your own games? Unity Learn is the best and easiest way to learn and master what you need to know. Read More .

This isn’t your only option though, Unity is only one engine, and there are plenty of game development software options 5 Free Game Development Software Tools to Make Your Own Games 5 Free Game Development Software Tools to Make Your Own Games Free game development software is a great way to start video game making. We've compiled the best game software on the market. Read More to choose from.

Explore more about: C, Game Development, JavaScript, Unity.

Enjoyed this article? Stay informed by joining our newsletter!

Enter your Email

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Mike
    July 6, 2019 at 7:34 pm

    Java has also gained ground, it has evolved, like Javascript, it wasn't a pretty language to use for webdev, but look at it now, Java has c++ simularity, and it's being updated, maintained and lots of fixes to old problems till the lastest fastest JVM, JRE.

  2. Victor
    March 7, 2019 at 10:00 pm

    It's a good article. Thank you