EntityQuery contains a filter with duplicate component type

I’m new to DOTS and I’m having a problem getting two jobs to run, one after the other. Sequencing is not a problem but I need to run them both with almost the same query. When I do I get the error “EntityQuery contains a filter with duplicate component type”

The code looks like this:

      var caculateJobHandle = Entities
            .WithAll<MoveSpeed>()
            .WithReadOnly(obstacle)
            .WithReadOnly(speeds)
            .WithReadOnly(transforms)
            .WithReadOnly(deltaTime)
            .ForEach((Entity entity, int entityInQueryIndex, in CreatureComponent creature, in PlayerInput playerInput) =>
            {
              .....
            }).Schedule(preprocessDeps);


        var updateJobHandle = Entities
            .WithAll<MoveSpeed>()
            .WithReadOnly(newSpeeds)
            .WithReadOnly(newTranslations)
            .ForEach((int entityInQueryIndex, ref Translation translation, ref MoveSpeed moveSpeed, ref Rotation rotation) =>
            {
                ....
            }).Schedule(caculateJobHandle);

It doesn’t seem to like the two references to MoveSpeed. How do I fashion two consecutive queries against the component.

TIA
Richard

I think your problem is your second query? You specify both .WithAll() and include MoveSpeed in the query itself.

2 Likes

Thank you very much, that was exactly right! All working now!

1 Like