Competing command buffers?

Do command buffers compete with each other in the sense of if you have one system+barrier applying a command, and then another system+barrier applying another command to the same component, will one override the other or do they both get applied in order of system update?

For reference I’m asking as I have an issue with a system where a command buffer doesnt appear to do anything, if I uncomment the code and ignore the commandbuffer job and update the ComponentDataArray separately it works.

full code https://hastebin.com/uhayijodav.cs with snippets of the job and what works but doesnt get jobified below.

        private struct CommandBufferJob : IJob
        {
            [ReadOnly] public EntityCommandBuffer commandBuffer;
            [ReadOnly] public EntityArray seeker_entity;
            [ReadOnly] public ComponentDataArray<Target> target_buffer;
           
            public void Execute()
            {
                for (int i = 0; i < seeker_entity.Length; i++)
                {
                    var entity = target_buffer[i].entity;
                    if (target_buffer[i].health <= 0)
                        entity = Entity.Null;
                   
                   
                    commandBuffer.SetComponent(seeker_entity[i], new Target
                    {
                        entity = entity,
                        position = target_buffer[i].position,
                        health = target_buffer[i].health,
                        canSee = target_buffer[i].canSee,
                        blockedSightTime = target_buffer[i].blockedSightTime,
                        raycastTimer = target_buffer[i].raycastTimer
                    });
                }
            }
        }
            for (int i = 0; i < seeker_entity.Length; i++)
            {
                var entity = seeker_target_buffer[i].entity;
                if (seeker_target_buffer[i].health <= 0)
                    entity = Entity.Null;

                var targ = new Target
                {
                    entity = entity,
                    position = seeker_target_buffer[i].position,
                    health = seeker_target_buffer[i].health,
                    canSee = seeker_target_buffer[i].canSee,
                    blockedSightTime = seeker_target_buffer[i].blockedSightTime,
                    raycastTimer = seeker_target_buffer[i].raycastTimer
                };
                seeker_target[i] = targ;


            }

They are applied in the order of barrier update if your 2 barriers are not the same.

If your have 1 barrier but commands from 2 systems applying to the same component, they are ordered by the order of barrier.CreateCommandBuffer call. Each ECB created gets a playback order from that.

Thanks, does PostUpdateCommands work in the same way then?

PostUpdateCommands is already an ECB, you cannot create more of it. Multiple access to PostUpdateCommands at a different time during Update goes to the same ECB. There is no barrier, this ECB Playback at the end of Update like the name says. Then the only ordering you have is the command queueing order. No CreateCommandBuffer or Barrier order.