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;
}