Detect if mesh is splitted

I am beginner in unity. I have a code that takes vertices of a mesh and then it creates a polygon(basically a mesh) from those vertices. The problem is that sometimes the mesh gets split into more parts and because the mesh has only one vertices the polygon is really messed up. Is there a way to know if the mesh is split and divide vertices into tho lists of vertices for each part of the mesh one list.