#Can't figure out how to disable Job container safety on pointed struct

1 messages · Page 1 of 1 (latest)

solid aspen
#

I'm getting this error:
System::InvalidOperationException: The Unity.Collections.NativeArray`1[System.Byte] has been declared as [WriteOnly] in the job, but you are reading from it.

#

The thing is that the collection is within this custom struct,

#

But none of the nested collections have "WriteOnly" on it. What's going on?

real ember
#

you can't have native containers behind a pointer

#

the safety system can't see them

#

therefore it can't apply attributes to them / inject the correct values into the safety handle

#

an unset safety handle throws a writeonly exception (what you're seeing)

#

if you want to use containers behind a pointer they need to be the Unsafe variants, not Native (i.e. UnsafeList instead of NativeList)

#

that don't have safety handles

#

(it would work fine if storage wasn't a pointer)

stable radish
#

I would store Native Collections in a separate structure and pass it to the Job by value