Hello, is the idea even possible? Because afaik using .SetComponent() would result in setting the whole Component, which is not my intention and when I tried it out, I got deallocation Exceptions. I didn't try fixing this approach if there is potentially an easier one
Is there maybe another way to queue some changes for NativeArrays?
My goal:
I want to increment some elements of a NativeArray inside of a IJobEntity.ScheduleParallel(). If I can queue up the incrementation and then do it all at once some time in the future then I could run the Job in parallel, otherwise the Job has to be sequential, since running it in parallel could lead to a race condition.
Potential solution to the problem:
I could think of a way where another NativeArray (arr2) gets used which stores the Indices of the first NativeArray (arr1).
Therefore, after the Job finishes, I could run over arr2 and do arr1[arr2[i]]++.
Since every Entity would have its own Index in arr2, no race condition could happen and writing in parallel would be possible as well (This idea just came up while writing the post)