I’ve been using it for SetAtomicSafetyHandle. It works fine in editor, but when I attempt to build the project, I get a build error claiming that “‘NativeArrayUnsafeUtility’ does not contain a definition for ‘SetAtomicSafetyHandle’”.
Is that intended behaviour?
I tried different combinations of packages, to check if it’s not some weird assembly reference issue with Unity.Collections package but that does not seem to be it. Moreover, AtomicSafetyHandle itself is also claimed to be missing when I try to build. I don’t have any asmdef files in the project so I’d expect it to compile correctly if it compiles for play mode.
AtomicSafetyHandle only exists when ENABLE_UNITY_COLLECTIONS_CHECKS is defined. It is typically not defined for builds.
1 Like
To add on to that – ENABLE_UNITY_COLLECTIONS_CHECKS isn’t needed in the editor and in release AtomicSafetyHandles don’t need to be set on NativeArrays.
This little piece of magic wasn’t really mentioned anywhere.