Here’s a free tip for everyone:
When using the BakeMesh function:
Mesh mesh=new Mesh();
GetComponent<SkinnedMeshRenderer>().BakeMesh(mesh);
Don’t forget to destroy the mesh after you’ve finished using it:
Destroy(mesh)
Otherwise you might end up with a big memory leak! It doesn’t get automatically garbage collected. Well not in unity 2018 anyway.