Intro to Unity ECS
This gitbook explains "how" to implement ECS in Unity. It does not explain "what" ECS is, but we make sure to provide links to external resources throughout the gitbook that explain the "what."
- Sub Scenes and conversions
- Setting components and variables during conversion
- Using EntityManager to make structural changes
- Using command buffers to make structural entity changes
- Setting up command buffers to run parallel jobs with CreateCommandBuffer().AsParallelWriter()
- Adding, setting, and removing components
- Generating authoring components and IConvertGameObjectToEntity interfaces
- Entity queries and .ForEach()
- Setting local variables for entity queries
- Scheduling a job with .Schedule()
- Scheduling a parallel job with .ScheduleParallel()
- Running on the main thread with .Run()
- Combining job handles with JobHandle.CombineDependencies()
- Create and destroy entities programmatically
- Create and move entities based on user input
- Create an entity from a prefab
- Adding cameras to entities
- Hybrid ECS
- New Build Configuration system
- Creating a base shared configuration
- Sub-second "play" start
If you can spare 64 minutes listen to Blizzard's Timothy Ford explain general concepts in ECS (Not Unity-specific ECS, actually Blizzard's own game engine, but the architectural concepts are the same) <-- ESPECIALLY RECOMMENDED FOR NETCODE
...and if you can spare 0 minutes to understand ECS:
So, yeah... Watch at least one of the videos. Top rec is the first one (Far North Entertainment)
Screenshot from the Far North Entertainment video above.
Sure, ECS is exciting, but from the Forum threads we linked to above, you can see that there is plenty of complexity that needs to be managed.
Learning a functional programming paradigm can be difficult. Shifting out of a OOP mindset dominance can be difficult, too. ECS demands both, to some degree.
Luckily, Unity's current ECS architecture is actually a hybrid (of both Monobehaviour and ECS), which eases you into the data-oriented paradigm if you are totally new to it.
- Watch an ECS explanation video(s)
- Read through Unity's high-level overview
- Read through Unity's "Entity Debugger" explanation