13-06-2026, 02:41 PM
In case anyone else encounter the same problem here is dirty quick fix in ObiStitcher:
Quick summary of problem causing errors:
Obi stitcher is implemented in a wrong way, it creates batches directly used by simulation, including data arrays like lambdas. For this reason anything that triggers removal of stitches from simulation while it's running will causes exception, because arrays can't be disposed. Things that trigger this error is: disabling stitcher, disabling any actor used by stitcher, application quit and exit playmode.
Code:
private void RemoveFromSolver(ObiSolver solver)
{
if (inSolver && m_BatchImpl != null)
{
if (solver.simulationInFlight)
{
ObiSolver.SolverStepCallback handler = null;
var lambdasList = lambdas;
var particleIndicesList = particleIndices;
var stiffnessesList = stiffnesses;
IStitchConstraintsBatchImpl batchImpl = m_BatchImpl;
handler = (ObiSolver solver, float timeToSimulate, float substepTime) =>
{
solver.OnSimulationEnd -= handler;
lambdasList.Dispose();
particleIndicesList.Dispose();
stiffnessesList.Dispose();
solver.implementation.DestroyConstraintsBatch(batchImpl);
batchImpl.Destroy();
batchImpl = null;
};
m_BatchImpl = null;
solver.OnSimulationEnd += handler;
}
else
{
lambdas.Dispose();
particleIndices.Dispose();
stiffnesses.Dispose();
solver.implementation.DestroyConstraintsBatch(m_BatchImpl as IStitchConstraintsBatchImpl);
m_BatchImpl.Destroy();
m_BatchImpl = null;
}
inSolver = false;
}
}Quick summary of problem causing errors:
Obi stitcher is implemented in a wrong way, it creates batches directly used by simulation, including data arrays like lambdas. For this reason anything that triggers removal of stitches from simulation while it's running will causes exception, because arrays can't be disposed. Things that trigger this error is: disabling stitcher, disabling any actor used by stitcher, application quit and exit playmode.

