Hello.
There are entities which have A,B,C,D components. There are other entities which have A,B,C,E components. I need to create two arrays of component A.
The first should consist of entities at which there are D and E components.
The second should consist of entities at which there are components D.
At the same time whether it is possible to make so that their indexes matched?
For example:
[ A(d), A(d), A(d), A(d) ]
[ A(d), A(d), A(d), A(d), A(e), A(e), A(e) ]
There is such assumption:
EntityQuery m_GroupFirst = GetEntityQuery (
new EntityQueryDesc {
All = new ComponentType [] {
ComponentType.ReadWrite<ComponentA> (),
ComponentType.ReadWrite<ComponentB> (),
ComponentType.ReadWrite<ComponentC> (),
ComponentType.ReadWrite<ComponentD> (),
},
//Any = new ComponentType [] {},
//None = new ComponentType [] {},
}
);
EntityQuery m_GroupSecond = GetEntityQuery (
new EntityQueryDesc {
All = new ComponentType [] {
ComponentType.ReadWrite<ComponentA> (),
ComponentType.ReadWrite<ComponentB> (),
ComponentType.ReadWrite<ComponentC> (),
ComponentType.ReadWrite<ComponentD> (),
},
Any = new ComponentType [] {
ComponentType.ReadWrite<ComponentE> (),
},
//None = new ComponentType [] {},
}
);
protected override JobHandle OnUpdate ( JobHandle inputDeps ) {
var arrayFirst = m_GroupFirst.ToComponentDataArray<ComponentA> ( Allocator.TempJob );
var arraySecond = m_GroupSecond.ToComponentDataArray<ComponentA> ( Allocator.TempJob );
On how many this correct solution?
Can perhaps make through one EntityQuery, but not two?