Why meshes require a restart when using CopySerialized?

I have two meshes:
assetMesh: this mesh is a copy of a mesh asset (FBX), modified, and saved as a .asset file.
tempMesh: this mesh is also the copy of the FBX mesh asset, but modified differently. It is not saved as an asset.

I wanted to replace all the data of assetMesh with the data of tempMesh. I tried EditorUtility.CopySerialized(tempMesh, assetMesh) followed by AssetDatabase.SaveAssets(). The asset is modified properly and saved to the disk. However, the editor doesn’t see the changes unless I restart Unity. I tried all the calls below, to force Unity to reimport. None of them worked.


Of course I tried right-clicking on the mesh and click Reimport. I tried creating new game objects with a mesh filter and renderer, but it was still using the old mesh. The ONLY solution was to restart Unity. The mesh asset doesn’t change on the disk, between closing and opening Unity.

I found a hack, listed below, to work around this issue. But, won’t CopySerialized work properly without a restart?

CombineInstance[] combine = new CombineInstance[1];
combine[0].mesh = tempMesh;
combine[0].transform = Matrix4x4.identity;


I stuck in the same problem and I found a solution.

assetMesh.Clear(); // this magically solve the problem
EditorUtility.CopySerialized(srcMesh, assetMesh);