Post Jam: An empty EntityQuery in OnCreate() disables your system


OK so interesting result of initialising an `EntityQuery` in a system's `OnCreate()` is that it's considered by `ShouldRunSystem()`.  If the query doesn't result in any contents, the System will not be started!  (`OnStartRunning()` and `OnUpdate()` won't get called.)

Tried moving the `EntityQuery` creation to `OnStartRunning()` and the system starts then immediately disables when it got 0 results!

Ahha, instead of creating the query with the `JobComponentSystem`-based `GetEntityQuery()`, use `EntityManager.CreateEntityQuery()` and it's not considered as part of the system's requirements!  Interesting.

Still running into the joint-already-present problem.  Could I be suffering from doing it in a single frame and I need a within-frame check of those already requested?  Yep.  Added those created in this frame to a `NativeList<Entity>` and checked that as well and voila!  It's works!

I might take this a little further to something what I'd hoped the entry to be -- something like a spider spewing tangly webs and dragging stuff about.

Let me know if you think it's worth it :)

<-PREV | NEXT->

Leave a comment

Log in with itch.io to leave a comment.