Skip to main content

What is ECS in Unity ?

Today, I will address common questions asked by Unity developers: 'What is ECS in Unity?', 'Is ECS worth using in your next project?', 'Can I convert my old project to Unity ECS?', and 'Where should I start learning Unity ECS?'. Stay with me as I cover all these answers in this post.

Welcome back! If you're not aware of why I created this blog, let me clarify. I'm converting an old Unity project to the new DOTS technologies. First, I’ll be using ECS to re-architect the project, and then I’ll delve into the physics aspects. Stay with me and enhance your skills by learning Unity ECS.

When I began learning Unity DOTS, I noticed several frequently asked questions and discussions posted on Reddit, Unity forums, and Unity Discord channels. Let me share my experiences and answer these questions.

Table of Content :

What is ECS in Unity?

The technical definition of ECS is available in Unity's official documentation. If you find it difficult to grasp, don’t worry—I'll explain it clearly using Unity's official comic-style images.

ECS stands for Entity Component System, which is part of Unity’s new data-oriented technologies called DOTS. To learn more about the other technologies included in DOTS, please check out 'What is DOTS.'

What is Entity ?

Let’s first understand what the term 'Entity' means. According to Wikipedia, an entity is 'something that exists as itself. It does not need to have material existence. In particular, abstractions and legal fictions are usually regarded as entities. In general, there is also no presumption that an entity is animate, or present.'


In simpler terms, an entity doesn’t have any components or data within it. An entity itself contains no data—it only has an ID. To understand this in the context of game development, imagine you have a character. How do you identify this character? By its mesh renderer, character controller script, transform component, and other Unity components, right? However, according to the definition of an entity, the character is essentially just an ID with associated components linked to it. Understood?

What is Component ?

A Component refers to the data that you use to store, manage, and manipulate as needed. In other words, in game development, we often use serializable classes to convert data into JSON or another format, allowing us to pass it through an API or store it locally. The key point is that a Component contains only data; it doesn’t include any logic, such as movement or update loops. I hope this makes sense, as we regularly use serializable classes in our everyday programming.

What is System ?

System—can you tell me in the comments what a system stands for? If you're unsure, let me give you an example to help clarify. In our game, we have a character controller, right? So, how do you achieve character movement, jumping, grabbing, and other logic? You likely write the logic to accomplish these tasks, correct? If your answer is yes, then you already have an understanding of what a system is. It's where we write the logic based on Component data to achieve the desired behaviour in our game.

Is ECS worth using in your next project?

Let me answer that. It’s entirely up to you, but I’d recommend using DOTS in your next project if your game involves numerous game objects and complex logic. According to Unity, DOTS is powerful enough to handle such behaviour while maintaining a high frame rate. You can learn more about the performance improvements in Unity's blog post.

Can I convert my old project to Unity ECS?

Yes, you can convert your project to DOTS; however, let me clarify that if you’re converting demo projects or prototypes, that’s perfectly fine. On the other hand, converting a live, published project to DOTS is not recommended. This is because transitioning to ECS effectively means rebuilding your project from scratch, and you won’t be able to reuse any of the programming components from your old project.

From a technical perspective, DOTS doesn’t follow traditional OOP (Object-Oriented Programming) principles for managing logic or programming. Instead, you’ll need to separate your logic into Systems, your data into Components, and your game objects into Entities.

If you’re interested in converting your project, the Unity ECS 101 blog is a great resource for you. I’m also in the process of converting a project to ECS.

Where should I start learning Unity ECS?

The biggest question is: When should you start learning ECS? Don’t worry—if I can learn it, so can you. But why is my approach good for you? Because I’ve already reached an intermediate level in ECS, and I’m here to share the best resources to help you start understanding and learning ECS.

First, it’s essential to understand how DOTS differs from OOP. Since DOTS doesn’t follow OOP concepts like encapsulation and abstraction, you should begin with Unity DOTS best practices by going through Unity’s official tutorials. After that, I recommend reading Unity’s official documentation on the ECS package.

Secondly, you should follow Unity’s official GitHub page on DOTS, as they provide video tutorials and example projects with best practices.

After going through the first two steps, you might feel frustrated and start to think that DOTS isn’t for you. That’s when you should turn to my resources, which offer a smooth and easy transition from non-ECS projects to ECS-based projects.

Next, follow my tutorials on how to convert your old Unity project into an ECS-based project. Why use my resources? Because after grasping DOTS best practices, you’ll need to learn the basics, such as adding and removing components, instantiating entities, and more advanced topics like parenting entities, using buffers for managing entity destruction, and working with arrays in ECS.

Finally, start asking your own questions and find answers using the documentation. It’s also a good idea to follow YouTube tutorials, check out relevant Reddit pages, and join Unity’s Discord community to get the best practice advice.

That’s it for now. In the next step, I’ll begin the Project Conversion posts, where you’ll learn how to convert non-ECS projects into ECS-based Unity projects. If you don’t want to miss out, be sure to revisit the Learn Unity 101 blog. If you have any questions, please leave a comment. Have a great day, and I hope you enjoyed this post!

Comments

Popular posts from this blog

Setting Up Unity DOTS: Creating and Configuring Your First Entity

Welcome back, Unity developers! Today, I will be setting up a non-ECS Unity project to run using the Entity Component System (ECS), Moreover you will setup your first subscene and create your first entity. I will address entity not visible issue. If you haven't yet checked the commonly asked questions about the Entity Component System , you should take a look first, where I've explained the basic definition of ECS in Unity. Setting Up Unity DOTS Creating and Configuring Your First Entity by LearnUnityECS101.Blogspot.com Table of Contents : Project Clone Instruction ECS Package Install and Setup Guide Setup ECS Scene Create Your First Entity Entity is not visible error Verify Your First Entity   Domain Reload Setting   Summarizing Project Clone Instruction: First of all, you need a Unity project in working condition. If you already have such a project, you can use it, but I would recommend using the project I am about to convert to Unity DOTS - ECS. Ple