AetherInteractiveLtd/Tina

ECS: Entities created during the `initialize` step will not match to `enteredQuery`

Closed this issue · 4 comments

Currently any entities made during the initialize step will never match to the enteredQuery method on Query as the query will not have existed at the point of creation.

This is intended behaviour in my opinion. I've added wontfix, people can loop through the matching entities on the query configuration step.

If you don't agree let me know and we'll look into fixing it.

I mulled over this for a while, but I would actually like to fix this if you're okay with it. A quite common pattern I've been doing is to create an entity with ComponentA, and then in another system I would have a system that looks for anything with ComponentA and not ComponentB, and then adds the relevant component to this - rather than needing to define all the components for an entity upfront. This approach is absolutely fine, but only if I'm not creating them in the initialize step, which, especially at the moment while I am predominantly using the initialize step to create entities that I am using for prototype work, is annoying!

You cannot particularly just loop over these entities as I was looking to do stuff with these entities in separate systems, so it is not easy to transfer an entityId from one system to another.

Why not just create the queries before initialize then? This seems like a very limited-scope issue that most people will never run into because - well - I've never needed to use initialize

... yes