Can you help me with my procedural colliders?

Questions & AnswersCategory: GeneralCan you help me with my procedural colliders?
ChrisK asked 3 years ago

Hi voxel master :-),
sorry that my question is a bit off-topic, but I’m quite impressed by your work and like to know how you make the generation of the MeshColliders not throwing the typical “cleaning the mesh failed” error… I created a tree plugin that makes procedural trees, but I’m always getting this error. I’m creating the meshes like this:
            Mesh sMesh = treeMesh [lod] [treeNum];
 //the same as: Mesh sMesh = tree.GetComponent().mesh;
            sMesh.Clear ();
            sMesh.vertices = verts;
            sMesh.normals = normals;
            sMesh.colors = colors;
            sMesh.uv = uvs;
            sMesh.uv2 = uvs2;
            sMesh.uv3 = uvs3;
            sMesh.triangles = indices.ToArray ();
           treeMeshCollider [lod] [treeNum].sharedMesh = null;
//the same as: tree.GetComponent().sharedMesh = null;
           treeMeshCollider [lod] [treeNum].sharedMesh = sMesh;

Maybe you could share some of your wisdom with us, I think that is not a complicated question for you, or is it?
Kind Regards,
Chris