Hello! I have several Entities which contain a "Target" ComponentData that points to another Entity in the same Chunk. Now, I am trying to process these Entities in an IJobChunk and having trouble converting the "Target" Entity.Index to a corresponding index in the NativeArrays created using chunk.GetNativeArray(). I know these entities are in the same chunk and are being processed in the same IJobChunk. How can I do this index mapping?
The Unity documentation suggests using EntityQuery.CalculateBaseEntityIndexArrayAsync() which would provide a baseChunkIndex. Then the conversion to/from chunk/Entity indices is just be Entity.Index - baseChunkIndex = chunk.index. But I get an IndexOutOfBounds exception when implementing this logic.