When using [WithPresent], EnableRefRW and IJobEntity it adds the component twice to the query.
[BurstCompile]
[WithPresent(typeof(ConditionAllActive))]
private partial struct ConditionAllActiveJob : IJobEntity
{
private static void Execute(EnabledRefRW<ConditionAllActive> conditionAllActive, in ConditionActive conditionActive)
{
conditionAllActive.ValueRW = conditionActive.Value.AllTrue;
}
}
Result
DefaultQuery =
entityQueryBuilder
.WithPresentRW<global::BovineLabs.Reaction.Data.Conditions.ConditionAllActive>()
.WithAll<global::BovineLabs.Reaction.Data.Conditions.ConditionActive>()
.WithAllRW<global::BovineLabs.Reaction.Data.Conditions.ConditionAllActive>()
.Build(ref state);```
However if you do it [WithDisabled]
```cs
[BurstCompile]
[WithDisabled(typeof(ConditionAllActive))]
private partial struct ConditionAllActiveJob : IJobEntity
{
private static void Execute(EnabledRefRW<ConditionAllActive> conditionAllActive, in ConditionActive conditionActive)
{
conditionAllActive.ValueRW = conditionActive.Value.AllTrue;
}
}```
It correctly produces the right query
```cs
DefaultQuery =
entityQueryBuilder
.WithDisabledRW<global::BovineLabs.Reaction.Data.Conditions.ConditionAllActive>()
.WithAll<global::BovineLabs.Reaction.Data.Conditions.ConditionActive>()
.Build(ref state);```
WithPresent just needs the same logic as WithDisabled.
If we can fix this then I think we can finally handle all enable states without the need for arbitrary EntityQueryOptions.IgnoreComponentEnabledState
@cedar sable
