Entity Component System

From Unify Community Wiki
Revision as of 21:55, 28 December 2018 by Isaiah Kelly (Talk | contribs)

Jump to: navigation, search

Contents

Introduction

The Entity Component System (ECS) is a new official framework for writing highly optimized, data oriented code in Unity. It's currently being developed by Unity Technologies as part of their “Performance by Default” initiative, along with the new C# Job System and Burst Compiler. The ECS package can be used by itself but is designed to work in unison with these other packages to vastly improve performance through automatic native code optimization and multithread support. Unity claims that using these new packages together can lead to as much as x100 speed improvements over the existing “classic” GameObject and MonoBehaviour architecture!

Development Status

Unity ECS is currently in "preview" and is therefore not yet considered production ready. This means you're free to use it to build games today but should be aware that it's currently in active development so you may encounter bugs and stability issues. Some features are also missing and the API will continue to evolve and change before the official 1.0 release. Unity currently recommends only using the new ECS package for experimentation or if you're just starting your project and plan to release towards the end of 2019 or later. Since the package should be quite stable by then.

Hybrid Approach

This new ECS architecture will eventually replace most existing “classic” systems in Unity (transforms, game objects, renderers, etc.). This will however happen “under the hood”, meaning that traditional Unity workflows will remain mostly unchanged. (e.g. constructing prefabs and adding components to them) However, at the moment there are only a few Unity features implemented in ECS and it will take several years to transition most systems over. This means you currently have to use a somewhat awkward “hybrid approach” if you wish to use most existing Unity features like Physics or Animators with ECS. This is done by using a mix of “classic” and ECS components together.

Installation

To use the new ECS features you need to install the Entities package via the Package Manager (introduced in Unity 2018.1) which is accessible from the toolbar menu “Window”. Using this package with the latest version of Unity is recommended since older versions may not be compatible or support all the latest package features.

Third-Party Alternatives

For developers looking for production ready ECS framworks or just want to explore other alternatives there are a few options out there. Most notable ones being Entitas by Simon Schmid and Svelto.ECS by Sebastiano Mandalà. Both of which have been battle tested in professional game productions and are actively maintained.

Resources

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox