Unity is a game engine partially popular due to its accessibility to anyone willing to try it, but also for its use for C#. While other game engines use C++ or their own scripting languages, Unity decided to use a language that wasn’t always popular for game development in the past.

Let’s see how Unity became such a powerful tool because of its use of C#, as well as a bit of how it got there.

  1. The Main Idea
  2. Changes Throughout The Years
  3. Unity’s Foundation
  4. The Power of DOTS

How Unity Utilizes C# In a Powerful Way

The Main Idea

While most game engines have developers use C++ or their own scripting languages, Unity has developers use C#. Yet in recent years, Unity Technologies has been pushing changes to its engine that seems to indicate that Unity is moving away from C++.

With their new Data-Oriented Technology Stack or DOTS, developers now have tools that make game development easier and more efficient, while also allowing them to utilize the different features of the C# language.

In this article, we are going to take a look at how Unity is building a more powerful game engine with DOTS and its Burst compiler. But first, let us take a quick look as to how they got there.

Changes Throughout The Years

Unity has gone through lots of changes over the years, including in the languages it uses. One of the reasons it is popular is because of its use of C# – yet it did not always just use C# as its scripting language.

In the past, Unity also lets developers use a language called Boo, which was dropped back in 2014, and a JavaScript-like language called UnityScript, which was dropped in 2017.

Both Boo and UnityScript were dropped because of their lack of users as well as their lack of functionality compared to C#. Here is a chart depicting the use of each language that was supported back in 2014:

How Unity Utilizes C# In a Powerful Way

C# was by far the most popular choice for Unity developers – it has many more features, and because of the way Unity is built, developers can build their games to be played on any device. Yet how do Unity games get put onto other platforms?

Unity’s Foundation

In order for games built in Unity to be more accessible to all kinds of platforms, Unity utilizes the Mono Project. Mono.NET is an open-source cross-platform implementation of the .NET Framework. It is because of Mono that developers can easily bring their projects to any kind of device, and with Mono, those cross-platform applications help improve the developers’ productivity. Without Mono, developers would have to create different variations of the same project for the game to be playable on different devices.

The Mono Project allows Unity developers to utilize the full strength of C# while offering a wide range of technologies that makes game development more efficient. And in recent years, Unity has been complimenting C#’s strength with its new technology: DOTS.

The Power of DOTS

DOTS, or Data-Oriented Technology Stack, is Unity’s new high performance, multithreaded tech stack that gives developers the ability to take full advantage of multicore processors. The developers over at Unity are aiming to “rebuild the core of Unity” with DOTS, which will make “great games run faster on multi-core processors without the heavy programming headache”.

What’s cool about DOTS is that it is being implemented into every aspect of the game developer experience. DOTS is (going to be) involved in the engine’s audio systems, its physics engines, its animations, its networking, its shaders, and so much more. The idea is that developers can “create more complex worlds faster.”

In a short 30-second demo made last September for the Unite Copenhagen conference, the developers showcased some of the DOTS’ current capabilities all in one project. In this project, they demonstrated how DOTS could be used to enhance a game dev’s workflow while increasing the project’s performance and strengthening its quality.

My personal favorite feature was how any update made in the editor was also updated in the live build of the game – and the live build they showed off was in a multiplayer session!

Currently, despite C# being its scripting language, Unity is built in C++. But in Unity’s mind, C++ seems to be holding the engine back. This is because it is much harder to get C++ to just do as it is told. So now, Unity seems to be trying to move away from C++ and instead build the game engine’s core components with C# and their own DOTS.

To accomplish this, Unity created the Burst compiler, which is Unity’s solution to turn C# code into machine language. Burst is a core part of DOTS, and Unity just released version 1.3 a few weeks ago. With Burst 1.3, the compiler is trying to improve and balance these following 4 areas of the user experience:

  • Scalability
  • Performance
  • Quality
  • Usability and Debuggability

This is the main idea of DOTS: to give developers a platform that allows them to easily scale their game, while also giving them the tools to think less about the performance and more about the design of their game. And the Burst compiler allows them to do this.

Summary

As a whole, Unity has come a long way as a game engine. From supporting three different languages to strengthening their engine using just one, Unity has become a game engine that can turn anyone into a game developer.

There is not a lot of information about DOTS. It’s a relatively new technology, and with most of the DOTS framework slated to be released throughout the Unity 2020 development lifecycle, which has yet to have its first official release, we have not seen a lot of games that have utilized the power of DOTS. Yet it won’t be long until we see some cool games made with the DOTS framework.

While Unity 2020 does not currently have an official release, you can give DOTS a try in the Unity 2020.1 beta or the Unity 2020.2 alpha!