I am using IJobParallel to calculate some relations in my Entities and for each index in IJobParallelFor I get 9 ints that should go to the output array. Unity doesn’t let me add more than batchNumber to the output array. How can I ensure Unity that what I’m doing is safe?
My code:
public struct SomeJob : IJobParallelFor
{
[ReadOnly] public NativeArray<Translation> translations;
[WriteOnly] public NativeArray<int> outputArray;
public void Execute(int index)
{
var t = translations[index];
int[] toAdd = /* some code that gets int[9] */;
for(int i = 0;i<toAdd.Length;i++)
{
outputArray[index*9+i] = toAdd[i];
}
}
}
I only came up with dirty idea of creating int9 struct with int int1,int2,int3 etc. and using NativeArray as outputArray but that’s grinding my gears when I think about it.