#Why am I getting InvalidOperationException in this case?

1 messages · Page 1 of 1 (latest)

vernal lantern
#
InvalidOperationException: The previously scheduled job ... writes to ...NativeArray DrawFieldArray. You are trying to schedule new job ... writes to same ...NativeArray DrawFieldArray```

The jobs in question with only relevant array:

```cs
struct SetXExposedSliceJob : IJobParallelFor
{
    [NativeDisableParallelForRestriction] public NativeSlice<ulong> DrawFieldArray;
}

struct SetXChunkBorderSliceJob : IJobParallelFor
{
     [NativeDisableParallelForRestriction] public NativeSlice<ulong> DrawFieldArray;
}

The NativeSlices point to the same NativeArray, but I have been very careful such that the jobs do not write to the same indices. Shouldn't NativeDisableParallelForRestriction avoid this error message?

tacit quail
#

That for restriction attribute only stops errors within the same job

#

Not between jobs

vernal lantern
#

So is there a way to avoid the error between jobs?

#

I suppose I could schedule them with dependency

#

But it would be nice to have them run concurrently

tacit quail
#

You have to use the turn off safety attribute instead

vernal lantern
#

Thanks

vernal lantern
tacit quail
#

no

#

[NativeDisableContainerSafetyRestriction]

vernal lantern
#

Ah

#

Hmm. That didn't work either