Unity Learn home
View Course Content

DOTS Best Practices

Course
Advanced
+300 XP
1 Hour55 Mins
(165)
Overview
Summary
If you’re working on a game (or other real-time simulation) that requires the most efficient CPU usage possible, then Unity’s Data Oriented Technology Stack (DOTS) is a great way to get the performance you need. However, to use DOTS successfully, you can’t simply grab the API documentation and dive straight in. Before you begin creating a project with DOTS you must understand the following:
  • The fundamental concepts of data-oriented design
  • Data-oriented design in Unity
  • The best practice advice in this guide
Data-oriented design (DOD) is a big change from the object-oriented programming (OOP) that many developers have spent their whole careers working with. This means that the learning curve for DOTS might be steep, and there are a lot of pitfalls that might stop you from getting the performance benefits you hope for. This Best Practice Guide contains advice to help avoid those pitfalls.
Sections 1 and 2 of this guide explain the fundamental knowledge you need to understand before starting to build DOTS applications, and the biggest obstacles to achieving good performance. Later sections contain techniques that you can use to squeeze even more performance out of the technology, but you must have a fundamental understanding of the basics to get good use out of them.
NOTE: This guide is not intended to be a comprehensive tutorial to all aspects of building a DOTS-based application. The primary focus of this guide is to help you obtain the best possible runtime performance in code written using the DOTS packages, with a particular focus on the Entity Component System. As such, there are many topics which fall outside the scope of this guide and are not covered in detail or mentioned at all. Here is an incomplete list of topics which aren’t covered here:
  • In-depth discussion of features which were primarily used in older, experimental versions of the Entities package, such as SystemBase and Entities.ForEach()
  • How to use the Baking system to author and convert entity data
  • How to create and use BlobAssets to represent memory-ready, read-only data
  • Some newer convenience features such as Aspects. Aspects can help to simplify complex entity queries but come with an additional runtime performance cost. This feature is under active development and may be featured in future versions of this guide.
  • Packages which supplement ECS but which are not a core part of DOTS, such as Entities Graphics, Unity Physics, Havok Physics for Unity, and Netcode For Entities
Select your Unity version
Last updated: June 22, 2023
2022.3
Language
English