When an FBX file is initially added to a project, Unity will automatically set up the Animation Clips for that FBX.:
However, if more animations are added to the FBX, Unity will not automatically import them. (For example, if I export a new version of an FBX with new animations, overwriting the old version of the FBX.)
So far, the only way I’ve found to get the FBX to show the added animations is to click the “+” at the bottom of the FBX Clips window, then find the new clip in the dropdown. This is pretty slow, and error prone.
I was hoping there was some way to force the FBX file to automatically reconcile the clips. Reimporting the FBX doesn’t do this, and I don’t see a way to keep this from being a very manual process.
I found the answer to my question in this old thread:
You’ll need to create an editor script to do this, but the basic idea is to load the ModelImporter for the FBX, and assign the defaultClipAnimations to the clipAnimations property. Seems to work fine. Here’s a minimal approach:
var path = "Assets/Models/Characters/CC/Leo/LipSync/LeoLipSync.fbx";
var importer = AssetImporter.GetAtPath(path) as ModelImporter;
importer.clipAnimations = importer.defaultClipAnimations;
AssetDatabase.ImportAsset(path);
AssetDatabase.SaveAssets();
It would be nice if this were just an option available in the Inspector, or right-click context menu for FBX files…