Let’s say I have a MyBufferElement, NativeList and a DynamicBuffer
What’s the fastest way to copy the contents of the NativeList into the DynamicBuffer from within a job? Is there a better way than a for loop?
Context:
I have a satic utility function that is basically a “FillBufferWithThings(ref DynamicBuffer myBuffer)”, but I would like this utility function to also be usable with a NativeList. I thought the INativeList interface would allow me to use it for both NativeLists and DynamicBuffers, but it doesn’t have an Add() function. So I’m guessing the next best thing would be to make it work with a NativeList, but then we can copy the contents of the NativeList to a DynamicBuffer if we want to. But unless the copy is extremely fast, I’d rather just make two different functions. I might need to be copying 1000 lists of up to 10 elements per frame