29-09-2021, 03:21 PM
(29-09-2021, 10:58 AM)josemendez Wrote: Found and fixed the issue. Quick explanation of the cause:
Every simulation step, the solver allocates a temporary native array to hold contact information if collision constraints are enabled. This array is disposed at the end of each timestep.
When the solver is not visible by any camera and deactivated, the contacts array is no longer allocated. However, contact callbacks are still being called, and asking for the size of the (disposed) array. Hence, ObjectDisposedException: Cannot access a disposed object.
Possible solutions are to either stop calling contact callbacks while the solver is out of view, or simply check whether the array exists before asking for its length. I've opted for the second solution, to not break consistency with older versions.
To apply the patch, download and replace the files I'm attaching to this post. They're found in
Assets/Obi/Scripts/Common/Backends/Burst/Constraints/ColliderCollision/
and
Assets/Obi/Scripts/Common/Backends/Burst/Constraints/ParticleCollision/
Let me know how it goes!
It worked. Thanks!