Catching Physics.PhysX error logs

Wonder if anyone has had the same need yet.

I got a few thousand meshes and a few hundred of them have unsolvable meshes for a convex collider, not really an issue just that even just logging the error is creating garbage and actually effecting perfomance at this scale.

[Physics.PhysX] QuickHullConvexHullLib::findSimplex: Simplex input points appers to be coplanar.
Failed to create Convex Mesh from source mesh β€œβ€. An internal unspecified error has occured that could mean the Quickhull algorithm found the input mesh topologically challenging.

So I thougt alright trigger the error catch it and remove the offending object (not an issue in this case). But it doesn’t seem to go through the .net Exception system or throug the Debug.unityLogger.

Has anyone needed this before or knows if there a way to catch them? Or alternatively another solution a way to easily find the offending meshes or turn of logging from physics with some reflection or something.

(Still on 2019.4)

I never had that error, but it sounds you have a strange mesh over there and the mesh collider cant make a collider with it.
You could use Try Catch Finally.

try
{
    //Try the thing fires the error
}
catch(exception ex
{
    //Do something with the exception (error)
}
finally
{
    //Do some stuff
}
1 Like

Yes that is one of the things that I tried but it seems it doesnt go through the .net Exception system, so its not getting caught, even though the stacktrace in the logs still points to the code in the try block. It seems Physx catches it itself and has a way to log it to Unity from the ccp side or something.

1 Like