Questions about UnsafeBufferAccessor

Hello! A question about the upcoming UnsafeBufferAccessor feature coming in Entities 0.17:

Will this allow me to simultaneously write to different indices of the same DynamicBuffer from two, parallel jobs?

I’ve really needed to do this in the past, but when I called GetBufferFromEntity() for the same type from two different systems, Unity would automatically create a dependency between those two systems - meaning the jobs would always run sequentially.

I had to create a workaround in which I cached a single BufferFromEntity in an earlier system, and then used it in multiple later systems, if I wanted those later system’s jobs to run in parallel. This works, but it’s a workaround I would be very happy to remove.

Does UnsafeBufferAccessor mean my workaround will no longer be necessary?

And:

Will the new ArchetypeChunk.GetUnsafeAccessor() function be the only way to retrieve these?

It looks like UnsafeBufferAccessor may not have made it into Entities 0.17 after all.

It only appears to be in the Changelog, but nowhere else in the Entities source.

There is a UnsafeUntypedBufferAccessor that you can retrieve via ArchetypeChunk.GetUnsafeUntypedBufferAccessor(ref DynamicComponentTypeHandle chunkBufferTypeHandle)

1 Like

Thanks! Name threw me off.