I’m looking for a way that I can get a job handle that can be used as a dependency for another job scheduling from an EntityCommandBufferSystem. The base class. Not the sub-classes that revolve around life-cycle events. The EntityCommandBuffer does not support waiting for a job handle, so I’m not really sure what my options are. The documentation is a bit sparse and I don’t see a way that I can both schedule the command buffer to playback after a job, and also acquire a job handle to wait on so the next job does not begin until that buffer is done with its playback. Honestly, any way that I can do that, without blocking, would be fine with me. I’m kind of thinking I might have to write my own EntityCommandBufferSystem subtype. I’m not sure.
I guess I should note here that the EntityCommandBufferSystem is a SystemBase that explicitly blocks during OnUpdate when given a job handle. What i would like is a non-blocking way to wait on dependencies. I’m not sure if this is possible to do the way we do for the jobs system without actually modifying core functionality within the ECS. If anyone has any ideas how to wait for a job handle in a non-blocking fashion with a command buffer, as we do when scheduling jobs, I’d love to know.
Alright, so here’s a more precise explanation of the issue. Because I need to write to the command buffer using a parallelwriter, I can’t actually use playback. If I could, I could simply put the buffer playback inside the job and pass it a handle. This would add some overhead in terms of scheduling the job, but it would allow me to wait asynchronously on the job that’s actually writing to the buffer and also start the next job after the buffer playback is completed. However, when using the parallel writer, I don’t have this option. Meaning that it seems I am going to have to rely on one on of the systems. The issue here being that these things don’t actually wait async, they literally just block until the job handle they’ve been given is completed, in their OnUpdate function. It’s actually kind of irritating how it’s designed. Because this completely removes the ability to write non-blocking systems if you need to run a job after another job that needs to filter the entities by the tags you’ve added in the previous job.
If ya’ll have any ideas, holler. I’m only on like day seven of working with ECS, so I may be missing something fundamental here.