I would like to reproduce in C# the same output than enabling the “Loop Time” checkbox and clicking on “Apply” in the ModelImporter inspector, on an FBX mesh asset. The following doesn’t work:
I tried a lot of things among using modelImporter.clipAnimations, modifying AnimationClips located in the asset (loaded with AssetDatabase.LoadAllAssetsAtPath), AnimationUtility.SetAnimationClipSettings(), EditorUtility.SetDirty(), modelImporter.SaveAndReimport(), AssetDatabase.SaveAssets(), AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate), AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(fbx))…
Nothing leaves the asset with the checkbox of any animation enabled, and Revert/Apply buttons are disabled (so the editor doesn’t detect any change I guess?).
Does anybody have a piece of code to apply changes made to an FBX asset by script? Especially in the animation clips?
Thanks in advance.
EDIT: By the way, it is a script designed to be executed in the Editor, not at runtime.
Copying all members was a needed step for me. Omitting them was throwing the warning “Split Animation Take Not Found” and AnimationClips were missing in the FBX asset.