CombineMeshes Error on Run-time Meshes

I’m attempting to combine the meshes of a few Game Objects generated at run-time. The meshes are generated with Leap Motion’s Pinch Draw script. This is the function I’m using to combine them:

    void MergeLineObjects()
    {
        GameObject noteContainer = GameObject.FindWithTag("AnnotationContainer");
        MeshFilter[] meshFilters = noteContainer.GetComponentsInChildren<MeshFilter>();
        Mesh finalMesh = new Mesh();
        CombineInstance[] combineInstances = new CombineInstance[meshFilters.Length];

        for(int i = 0; i < meshFilters.Length; i++)
        {
            meshFilters*.sharedMesh.Optimize(); //Might not do anything*

combineInstances*.subMeshIndex = 0;*
combineInstances_.mesh = meshFilters*.sharedMesh;
combineInstances.transform = meshFilters.transform.localToWorldMatrix;
}*_

finalMesh.CombineMeshes(combineInstances); // Getting error: Cannot combine mesh that does not allow access: Line Mesh
meshFilters[0].sharedMesh = finalMesh;
meshFilters[0].gameObject.SetActive(true);
}
}
When running this, I get the error:
Cannot combine mesh that does not allow access: Line Mesh
None of the mesh objects are static, and my function is basically following the example for CombineMeshes() in the Unity Documentation. Has anyone else run into this?
Thank you!

Solved this!

Within Leap Motion’s Pinch Draw script, there is a function called FinishLine() that completes the generation of the user-drawn mesh. Within that function, they used the mesh function UploadMeshData() with the parameter ‘markNoLongerReadable’ set to ‘true’, meaning that data could not be read from the mesh after it was created.

This was preventing the meshes from being combined, and simply changing the value of the ‘markNoLongerReadable’ parameter to ‘false’ fixed the issue!

The code before:

public void FinishLine() {
        _mesh.Optimize();
        _mesh.UploadMeshData(true);
      }

The code after:

public void FinishLine() {
        _mesh.Optimize();
        _mesh.UploadMeshData(false);
      }

Easy as that!

where i can call FinishLine() Function . Please Explain Clearly.