In the changelog of Unity 2021.2.8f1 there was a fix for an issue with GetSubArray.
This seems to have broken passing NativeLists to IJobParallelForDefer jobs.
Normally the scheduler would update the pointer to the NativeArray returned by list.AsDeferredJobArray() to the current size of the NativeList when starting the job. After the “fix” it gives an access violation.
Kernel: Fixed an issue where low bit set in NativeArray buffer pointer assumes NativeArray is created by NativeList.AsDeferredJobArray, which is not always the case. In some cases NativeArray can be created by NativeArray.GetSubArray, where pointer would have lowest bit set for odd byte aligned offset. (1294627)
It looks like the same “fix” will enter Unity 2022.2.0a1 and Unity 2020.3.26f1 breaking functionality there also.
Wow: very impressive technically and definitely working. I spent days trying to fix my mistakes on compound colliders while it was just this bug… Thank You so much.:):)
EDIT: I do regret that Unity does not have a template ECS project for testing prior to releasing a LTS, if they would have tried any basic project, they would have found that bug as here it is a base part (body) of a base package (physcis).
I did use Unity 2019 until now, because 2020 LTS is utterly broken: you can not even put a sphere on a plane (with ECS) in a brand new project without bug. It is strange how could something like that happen and even stay like that for a while…
I appretiate the fix by @tertle , it does help… But I hope it would be fixed officially.
It’ll (likely) be fixed in collections 1.2 except this will not support the current version of entities so we’ll have to wait till 0.50 is released before it’s fixable with entities without a custom package.