Unity only draws first submesh

I have a procedurally created skinned mesh

 //create Game object and meshes etc
Mesh mesh = new Mesh();
mesh.name = new string(shape.name);
mesh.vertices = verts.ToArray();
mesh.subMeshCount = submesh.Count;
for (int i = 0; i < submesh.Count; ++i)
{
    mesh.SetTriangles(submesh[i], i);
}

mesh.normals = skNorms.ToArray();
renderer.sharedMaterial = new Material(Shader.Find("Diffuse"));
skRenderer.sharedMesh = mesh;
mesh.boneWeights = weights.ToArray();
mesh.bindposes = bindPoses;
skRenderer.bones = bones.ToArray();

There are about 90 sub-meshes but only the first one is drawn

I also tried this using the regular mesh filter + renderer combo. No luck

I guess this is an editor mode problem.
Unity does not instantiate sub meshes in editor mode
So I had to “double buffer” to force initialization of the mesh then copy it over.

 ////////////TRIS
                    List<int> _tris = new List<int>();
                    for (int i = 0; i < mesh.triangles.Length; i++)
                    {
                        int t = mesh.triangles[i];
                        _tris.Add(t);
                    }
                    mesh.triangles = _tris.ToArray();

Submeshes require a material array. So renderer.sharedMaterials, rather than renderer.sharedMaterial.

–Eric

But Meshes draw without materials
Mine didn’t even show the pink thing. It showed nothing at all except the first sub-mesh

Actually that worked.