private static void FH_ComputeHulls(GameObject obj, ProgressDelegate progress = null)
{
if (obj == null || shouldCancelBatch)
return;
ConcaveCollider current = obj.GetComponent<ConcaveCollider>();
bool hadComponent = current != null;
Debug.LogWarningFormat("Processing mesh: {0}", obj.name);
if (current == null)
current = obj.AddComponent<ConcaveCollider>();
try {
if (current.ComputeHulls(new ConcaveCollider.LogDelegate(Debug.Log), progress))
Debug.LogFormat("Completed computing hulls for {0}", obj.name);
else
Debug.LogWarningFormat("Error computing hulls for {0}", obj.name);
}
catch(System.Exception e)
{
Debug.LogWarningFormat("Error computing hulls for {0}: {1}\n{2}", obj.name, e.Message, e.StackTrace);
}
Debug.LogWarningFormat("Finished processing mesh: {0}", obj.name);
UnityEditor.EditorUtility.ClearProgressBar();
if (!hadComponent)
DestroyImmediate(current, true);
}