private static string[] ExportAtlasUnityMeshPrefab(MA_TextureAtlasserProAtlas atlas, ModelExportSettings modelExportSettings, string material = null, string savePath = EXPORT_ASSET_PATH) { if (atlas == null || atlas.textureQuads == null) { return(null); } List <string> assetPaths = new List <string>(); foreach (MA_TextureAtlasserProQuad quad in atlas.textureQuads) { //Export Mesh if (quad.meshes != null) { for (int m = 0; m < quad.meshes.Count; m++) { if (quad.meshes[m] != null) { //Create new mesh Mesh newMesh = new Mesh(); //Duplicate it from the current one newMesh = MA_MeshUtils.MA_DuplicateMesh(quad.meshes[m]); //Remap UV's newMesh = MA_MeshUtils.MA_UVReMap(newMesh, atlas.textureAtlasSize, quad.guiRect, modelExportSettings.uvChannel, modelExportSettings.uvFlipY, modelExportSettings.uvWrap); //Set name string meshName = string.IsNullOrEmpty(quad.name) ? "" : quad.name + "-"; meshName += quad.meshes[m].name; int n = m + 1; meshName += "_" + n.ToString("#000"); newMesh.name = meshName; //Save it string asset = MA_MeshUtils.MA_SaveMeshPrefab(newMesh, meshName, savePath, materialPath: material); assetPaths.Add(asset); } } } } return(assetPaths.ToArray()); }