04-12-2023, 07:38 AM
(01-12-2023, 03:22 AM)kaser Wrote:Code:System.ObjectDisposedException: The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it
at (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow_Injected(Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle&)
at Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) [0x00000] in <b41119cc6741409ea29f63c7f98de938>:0
at Obi.ObiNativeList`1[T].Dispose (System.Boolean disposing) [0x0003f] in ....\Standard Assets\Vendor\Obi\Scripts\Common\DataStructures\NativeList\ObiNativeList.cs
Hi, I got an error message after game start while using the Obi , as shown above.
Please help me to fix this error
The following is the current version information used in the project
Unity 2022.3.6f1
Burst 1.8.8
Jobs 0.70.0-preview(Exp)
URP 14.0.8
Mathematics 1.2.6
Collections 2.1.4
Obi Cloth 6.5.4
Obi Rope 6.5.4
If you need further information, please let me know
12月1日 1:02
I checked the error code and found strange parts.
The Dispose process used Bool, but it was not actually used in the Function
Therefore, I added a correction, but I am not sure if this correction is correct.
After more digging . I think Obi's implementation of Create and Dispose may have missed implementations, resulting in Dispose not running properly.
If anyone is also investigating, welcome to join
#5 Solution
ObiNativeList.cs
Code:protected void Dispose(bool disposing)
{
if (isCreated)
{
// dispose of compuse buffer representation:
if (m_ComputeBuffer != null)
{
m_ComputeBuffer.Dispose();
}
// free unmanaged memory buffer:
UnsafeUtility.Free(m_AlignedPtr, Allocator.Persistent);
m_AlignedPtr = null;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
try
{
// dispose of atomic safety handle:
AtomicSafetyHandle.CheckDeallocateAndThrow(m_SafetyHandle);
AtomicSafetyHandle.Release(m_SafetyHandle);
}
catch (Exception ex)
{
Debug.LogError(ex);
}
#endif
}
}