Entity Component System
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!
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.
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.
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.
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.
- Unity ECS Documentation - Official documentation (work in progress).
- Unity ECS Overview - Covers main concepts and terminology.
- Unity ECS FAQ – Answers to frequently asked questions about Unity ECS.
- Unity ECS Cookbook - Tips, tricks and best practices for common situations.
- ECS Examples - Collection of links to various sample projects.
- Unity Hybrid ECS - Explains how to use both "classic" and ECS components together.
- ECS 101 - An introduction to Unity's new Entity Component System.
- Roll-A-Ball ECS - Recreation of official Unity Roll-a-ball tutorial in pure ECS.
- Survival Shooter ECS - A port of Unity's Survival Shooter tutorial project to the Entity Component System.
- Space Shooter ECS - This project is meant to be a "Rosetta Stone" for understanding how to get started with Unity ECS.
- Minecraft ECS - Workshop project showing how to make a voxel based game environment using hybrid ECS.
- Classic to Hybrid - Shows how to progressively integrate ECS into existing Unity projects.
- Samples - Official Unity ECS samples repository on GitHub.
- Nordeus RTS Demo - Source to Unite Austin presentation showing a massive RTS battle simulation.
- C# Job System Cookbook - Various examples showing how to use the job system at scale.
- Another Thread ECS - Project showcasing entities and the C# Job System.
- Voxelman - Fun example that shows how to use the new Entity Component System with Unity in an extreme way.
- ECS Physics - A custom C# physics engine made using pure ECS.
- Firefly - Example showing the creation of special effects using Unity ECS.
- Navmesh and MapBox - A demo implementation of Unity Entity Component System with NavMesh.
- Unity MMO - Client and server built using Unity ECS, xlua and skynet.
- OSM Traffic Sim - A project to simulate city traffic.
- Instanced Sprite Renderer - Simple example of how to create a performant instanced sprite renderer.
- uSpringBone - High performance SpringBone using ECS and JobSystem in Unity.
- ECS Tween - A very simple Unity tweening engine using pure ECS that works with GameObjects!
- BEPU Physics for Unity ECS - Translation in progress of BEPU Physics library v1 to Unity's ECS and Job System.
- ECS 2048 - 2048 like game using Unity's ECS.
- ECS ZombieSimulator - Pretty self explanatory ;)
- Boids Simulation - Another boids simulation that is different from the one featured in the official samples.
- Bovine Labs Entities - Collection of useful extensions and more by Timothy Raines (tertle).