There seems to be many other occurrences of this problem, but there hasn’t been any response or fix yet. In my case, I’m using the AssetPostprocessor (specifically OnPostProcessAllAssets) to create a prefab of an imported FBX model as it comes in. I am able to instantiate a GameObject from the FBX, make some modifications to the animation curves, then reattach them to the instantiated object. However, when I try to copy this instantiated object into a prefab, the clips disappear. The clip array is still sized correctly, but everything is gone. It doesn’t matter if I do this by drag-and-drop or through PrefabUtility.ReplacePrefab. Why is this happening?
I still can’t figure this out. Is this a bug? Is it something that’s just on my end? I’d report a bug, but something else is wrong and the Unity bug reporter won’t run…
For anyone wondering what the deal is here, I figured it out. You have to create the asset in the Asset Database after creating the object. Simply creating a clip and putting it on the object in a scene lets it work in a scene. To make it work as a prefab, you have to add the clip to the database.
AssetDatabase.CreateAsset(newClip, assetPath);
AssetDatabase.SaveAssets();