26-02-2019, 02:22 PM
(This post was last modified: 26-02-2019, 02:25 PM by josemendez.)
Hi,
In your code you're removing all actors from the solver, even those that have been already removed. Clearing the _GeneratedActors list at the end of RemoveAllGenerated() fixes the issue. Re-(re-re-re- )removing actors is not good practice, however it should not crash.
There's indeed a bug in Obi that causes redundant removal of cloth actors to unpin memory multiple times. Place lines 214-220 of ObiCloth.cs inside the "if" clause right before them. The entire method should then look like this:
Let me know how it goes, and thanks for reporting this!
In your code you're removing all actors from the solver, even those that have been already removed. Clearing the _GeneratedActors list at the end of RemoveAllGenerated() fixes the issue. Re-(re-re-re- )removing actors is not good practice, however it should not crash.
There's indeed a bug in Obi that causes redundant removal of cloth actors to unpin memory multiple times. Place lines 214-220 of ObiCloth.cs inside the "if" clause right before them. The entire method should then look like this:
Code:
bool removed = false;
try{
// re-enable Unity skinning:
if (clothMesh != null)
clothMesh.boneWeights = sharedMesh.boneWeights;
if (solver != null && InSolver){
Oni.DestroyDeformableMesh(Solver.OniSolver,deformableMesh);
deformableMesh = IntPtr.Zero;
Oni.UnpinMemory(particleIndicesHandle);
Oni.UnpinMemory(meshTrianglesHandle);
Oni.UnpinMemory(meshVerticesHandle);
Oni.UnpinMemory(meshNormalsHandle);
Oni.UnpinMemory(meshTangentsHandle);
CallOnDeformableMeshTearDown();
}
}catch(Exception e){
Debug.LogException(e);
}finally{
removed = base.RemoveFromSolver(info);
}
return removed;
Let me know how it goes, and thanks for reporting this!