Component Level IgnoreComponentEnabledState

Is it possible to ignore the enabled state in a query at the component level?

SystemAPI.Query<EnableableCompA, EnableableCompB>()
// .WithOptions(EntityQueryOptions.IgnoreComponentEnabledState)

EntityQueryOptions.IgnoreComponentEnabledState ignores all Enableables.
I want the query to run only if EnableableCompA is enabled but no matter whether EnableableCompB is enabled or not.

I’m currently using a ComponentLookup to get the desired functionality, but given the query is not the same as an optional query (we know that EnableableCompB exists), I was wondering if this was possible.

2 Likes

I’ve recently run into this problem too. I have a system that will enable the EnableComponentA no matter whether it is disabled or enabled. I can’t include the component in the query since it depends on other enableable components too. So, to set the state of EnableComponentA, I have to use EntityCommandBuffer assumed the component exists on that entity.

I really want to limit the use of EntityCommandBuffer. Since we can already enable or disable the component by using EnabledRefRW<> in IJobEntity.

1 Like