Why use EntityQuery on update

Abner Santos

New member
I'm not sure this still applies to BDP3 so please let me know if that's the case.

I was just wondering why the default generated code for ECS tasks uses EntityQueries built on OnUpdate instead of:
1) An entity query cached on OnCreate for better performance (it's recalculated on call, no need to create it every frame)
Or even better
2) No entity query at all. The Job's Execute parameters plus job attributes ([WithAll], [WithNone], etc) are enough for it to auto generate a query.
Thank you!
 
In version 3 I started to move the query to OnCreate and never finished it. Thanks, this will be in the next version :)
 
However, any reason why not opt for the second option? Just personal preference? It's pretty clean.
Completely personal preference. I don't like too many attributes so I feel like I have more control but deep down I know that it's the same thing 😄

why is the reevaluate task not already setup as a job and is a Query instead?
You mean the reevaluate system from the template, correct? This is just to show the different ways to do the same thing. If for example you rarely have an ECS task run without many entities using it then it may be more performant to not schedule the job.
 
Back
Top