Flushing AssetImporter.assetBundleName and userData changes

I have code that modifies the AssetImporter.assetBundleName during our build process, these changes however only randomly appear to get flushed back to the .meta files unless I call SaveAndReimport() on each importer immediately after the modification. (I’m setting the assetBundleName as infrequently as possible - and only when it has changed).

SaveAndReimport() is a bit of a sledgehammer fix as it forces the entire asset to be re-imported rather than one line of text being flushed to a .meta file - this significantly impacts our build times and generally fluidity of our Editor code.

Is there a better way of simply flushing the .meta changes.

Note: The also applies to the AssetImporter.userData field which I’m making extensive use of.

I meet the same problem, is there any way to speed up it?
I try to use EditorUtility.SetDirty for each importer, and AssetDatabase.SaveAssets at last, but it not work. The assetbundle is change in editor, but not flush into disk~

Also struggling with this, using 2019.1, specifically the same issue but with the userData field in the metafile. My editor scripts seem to be able to save things to the meta files correctly at first, but subsequent updates only work in memory and aren’t flushed to disk even after calling AssetDatabase.SaveAssets();

Picked up a trick from this thread: AssetImporter.userData not writing to the meta file in 4.6?

Deleting the meta file (using system.io.file.delete()) and then calling writeimportsettingsifdirty and assetdatabase.saveassets (causing it to recreate the metafile) seems to work. I then have to call Assetdatabase.refresh() or it seems like other changes aren’t processed.