GetComponentDataFromEntity on EntityManager

Is there a reason this is internal? As far as I can tell, the system method just calls up to the EntityManager method after doing some automatic dependency management. It would be helpful to expose the method on EntityManager so we can use it directly.

Is there a reason you need it? I’d be very curious about your use case. If you’re using EntityManager you can just use GetComponentData instead

I’m using it to copy data between two worlds with identical entity indexes (deterministic rollback). I tried using the EntityManager directly in batch job at first, like:

public struct RollbackWorker : IJobEntityBatch
{
  public EntityManager SnapshotEntityManager;
  ...
  public void Execute(ArchetypeChunk chunk, int index)
  {
    var entities = chunk.GetNativeArray(EntityTypeHandle);
    var translations = chunk.GetNativeArray(TranslationTypeHandle);

    for (var i = 0; i < chunk.ChunkEntityCount; i++)
    {
      translations[i] = SnapshotEntityManager.GetComponentData<Translation>(entities[i]);
    }
  }
}

That worked. Unfortunately I found that Burst wouldn’t let me mark the SnapshotEntityManager as [ReadOnly], which I think will cause some concurrency issues. So instead I switched my snapshot data lookup to read-only ComponentDataFromEntity, which Burst was fine with, but then had to create a dummy system in my snapshot world (which otherwise has no systems) just so I could call GetComponentDataFromEntity for that world.

If I could get concurrent read-only access to the snapshot EntityManager I absolutely could use GetComponentData, although now that I’ve switched to ComponentDataFromEntity the syntax is a little more compact, which is nice.

I could also use EntityManager.CopyAndReplaceEntitiesFrom but it currently lacks some features, and I’m seeing strange results with it .