In many cases, the optimal solution for both performance and clean code is to utilize IJobEntity with EntityQuery (with Burst, of course). However, there are situations where code reusability is not necessary (when we are certain it will only be used once) - in those cases, the idiomatic Query provides a simple and straightforward alternative. As tertle explains in the Unity Forum (forum.unity.com/threads/getentityquery-vs-entityquerybuilder.1401472/), it is generally better to create QueryBuilder right away since Query calls QueryBuilder underneath anyway. Creating EntityQuery through QueryBuilder allows you to easily force these queries to be satisfied before the system is executed. This ensures that the system will not perform redundant operations if the EntityQuery is empty.
@@TaleForgeStudio Then, to get all the benefits of both ways could use the IJobEntity and the ISystem.OnCreate() call to check the state.RequiereForUpdate(query) to avoid the job schedule, right?
Cool video. One question, what is the difference between using a query builder to get native arrays and using idiomatic querys or an IJobEntity?
In many cases, the optimal solution for both performance and clean code is to utilize IJobEntity with EntityQuery (with Burst, of course). However, there are situations where code reusability is not necessary (when we are certain it will only be used once) - in those cases, the idiomatic Query provides a simple and straightforward alternative.
As tertle explains in the Unity Forum (forum.unity.com/threads/getentityquery-vs-entityquerybuilder.1401472/), it is generally better to create QueryBuilder right away since Query calls QueryBuilder underneath anyway.
Creating EntityQuery through QueryBuilder allows you to easily force these queries to be satisfied before the system is executed. This ensures that the system will not perform redundant operations if the EntityQuery is empty.
@@TaleForgeStudio Then, to get all the benefits of both ways could use the IJobEntity and the ISystem.OnCreate() call to check the state.RequiereForUpdate(query) to avoid the job schedule, right?
Exactly!