Unity offers a free plugin to export meshes as fbx files from the editor. Yesterday, I tried to find out how to call the export function from code. Finally, I got it running but not during runtime but only from an editor script.
FbxExporters.Editor.ConvertToModel.Convert(target.gameObject, null, savePath, null, null, null);
Whereever, you include this line of code make sure it is in a folder called Editor. Otherwise the class FbxExporters.Editor won’t be visible. Unfortunately, there remains a limitation. You can only write your fbx files to the Assets folder and not to an arbitrary folder on your hard drive. If you figure out how to solve this, please tell me 🙂