static bool GetMeshForPBComponent(ModelExporter exporter, ProBuilderMesh pmesh, Autodesk.Fbx.FbxNode node) { Mesh mesh = new Mesh(); MeshUtility.Compile(pmesh, mesh, s_FbxOptions.quads ? MeshTopology.Quads : MeshTopology.Triangles); var pMeshRenderer = pmesh.GetComponent <MeshRenderer>(); var sharedMaterials = pMeshRenderer ? pMeshRenderer.sharedMaterials : null; exporter.ExportMesh(mesh, node, sharedMaterials); Object.DestroyImmediate(mesh); //Need to have ExportOptions accessible to remove this reflection var exporterType = exporter.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance) .First(x => x.Name == "get_ExportOptions").Invoke(exporter, null).GetType(); if (exporterType == typeof(ConvertToPrefabSettingsSerialize)) { // probuilder can't handle mesh assets that may be externally reloaded, just strip pb stuff for now. StripProBuilderScripts.DoStrip(pmesh); } return(true); }