Ecs And JobSysyem

Hello (I am not sure if its in the right forum if its not please inform me where to reopen),
I recently started to work with ECS and the job-system but I’ve encountered some issues.
when i try to move an entity array by translation nothing happens.
if some one can give me a tip why it doesn’t work ill be really grateful.
here is the piece of code:

public class SpreadCardsSystem : JobComponentSystem
{
    [RequireComponentTag(typeof(MyCards))]
    struct SendCardsToPosJob : IJobForEachWithEntity<Rotation, MyCards, Translation>
    {
        [DeallocateOnJobCompletion] [ReadOnly] public NativeArray<CardWithPos> eCards;
        public EntityCommandBuffer.Concurrent entityCommandBuffer;
        public void Execute(Entity entity, int index, ref Rotation rotation, ref MyCards myCards, ref Translation translation)
        {
            translation.Value = eCards[index].position;
            rotation.Value.value.z = 90f;
            entityCommandBuffer.SetComponent(index, eCards[index].entity, translation);
        }
    }
    private EndSimulationEntityCommandBufferSystem endSimulationEntityCommandBufferSystem;
    protected override void OnCreate()
    {
        endSimulationEntityCommandBufferSystem = World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
        base.OnCreate();
    }
    protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        JobHandle jobHandle = new JobHandle();
        try
        {
            EntityQuery entityQuery = GetEntityQuery(typeof(MyCards), ComponentType.ReadOnly<Translation>());
            NativeArray<Entity> arr = entityQuery.ToEntityArray(Allocator.TempJob);
            if (arr.Length == 0)
            {
                arr.Dispose();
                return jobHandle;
            }
            else
                Debug.Log(arr.Length.ToString());
            NativeArray<CardWithPos> enemyCardWithPosArr = new NativeArray<CardWithPos>(arr.Length, Allocator.TempJob);
            for (int i = 0; i < arr.Length; i++)
            {
                enemyCardWithPosArr = new CardWithPos
                {
                    entity = arr,
                    position = new float3(4f + (-2 * i),-3f,0)
                };
            }
            arr.Dispose();
            SendCardsToPosJob sendCardsJob = new SendCardsToPosJob
            {
                eCards = enemyCardWithPosArr
            };
            enemyCardWithPosArr.Dispose();
            jobHandle = sendCardsJob.Schedule(this, inputDeps);
            endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(jobHandle);
        }
        catch (System.Exception)
        {
        }
        return jobHandle;
    }
}

Hi and welcome!
I mainly work with Jobs, less with ECS, so i’m not sure if i can actually help, but:
Please use Code Tags :slight_smile: It’s the first sticky on this sub forum. The way it is now, hardly anybody is going to bother reading it, and there arent a ton of people working with DOTS anyways, so you dont want to scare them off hehe.

Data Oriented Technology Stack
DOTS forum section is relevant to ECS and Jobs questions.

Other than that, as already mentioned, please use Code Tags

Using code tags properly

Thank u I opened the same question there and added code tags :slight_smile: