#What the different between these EntityCommandBuffer?

1 messages · Page 1 of 1 (latest)

modern cape
#

What the different between these two way to create EntityCommandBuffer ?
this
var ecb = new EntityCommandBuffer(Unity.Collections.Allocator.Temp);
and this

       var ecb = ecbSingleton.CreateCommandBuffer(state.WorldUnmanaged);```
tidal glacier
#

Second one is managed by an ecb system, meaning it’ll be played back automatically when that system runs

#

First one is one you need to playback yourself at some point

modern cape
#

So, is it recommended to use the automatic one in most usecase? but use the manual one for parallel job, is it correct?

tidal glacier
#

No, parallel jobs can use the ecb system managed ones as well. You just use .AsParallelWriter() like always.

#

Manual is if you for whatever reason want to run a command buffer at a specific point instead of using the common ecb systems. Manual would be bad since you’re going to add a sync point, so only use that if you have no other choice, like you know you absolutely need the ecb to execute immediately before some other systems run