Getting 2 IBufferElementData on different entities into the same job

Im trying to get IBufferElementData into my job but it feel really clumsy to me. Below is what im trying to achieve, the buffer components are on separate entities so IJobForEach_BB is no good to me. Any help would be appreciated.

        [BurstCompile]
        struct GetMeshVerticesPositions : IJobForEach_B< IntBufferComponent_A>
        {
            [WriteOnly]public NativeArray<int> writeArray;
            [ReadOnly]public NativeArray<IntBufferArray_B> b; // NOT SURE HOW TO GET THIS !!!

            public void Execute(DynamicBuffer<IntBufferComponent_A> a)
            {
                for (int i = 0; i < a.Length; i++)
                {
                    writeArray[i] = b[a[i]];
                }
            }
        }

Just use BufferFromEntity

I started going down that track but how do I get the entity , the buffers are on different entities. what am i missing here

if the buffers are on different entities how are they related?

one buffer hold positions other buffer is an index into that position buffer

There has to be some type of relation between your 2 entities correct?

Are you suggesting I keep them on the same entity ?

Not really suggesting anything. I’m trying to figure out the relationship between your 2 entities, which must exist as one clearly depends on the other, and why and how it exists. Is it one-to-one, one-to-many, many-to-one, is one a singleton, etc as the setup seems quite unusual.

If you are asking a buffer on another entity, you should be using BufferFromEntity and there must be some type of relation to get the reference to the entity. If it’s not from some third party system, physics raycast for example, then one entity should be holding a direct reference to the other entity.

Yea that makes sense , I should add the direct reference to the entity. Never occurred to me , thanks heaps