AnimationCurve not saved correctly in custom ScriptableObject

Hi.
I made a script editor to animate meshes by morphing their meshes between several target meshes. I use an AnimationCurve to make the interpolation between meshes. I edit the curves with the “EditorGUI.CurveField()” function inside my script edidor and then store them in a ScriptableObject (I save the scriptable object containg the curve using EditorUtility.SetDirty() + AssetDatabase.SaveAssets() + AssetDatabase.Refresh()).

The problem is when I Exit Unity and reload it,the curves stored in my scriptable object are “default” curves (= same as AnimationCurve.EaseInOut) and not the one I edited in with the CurveField function in my editor script.

I found a trick : if I manually edit the created curves after their creation(accessing to them with the “project pannel” and not with my editor script) before exiting Unity, the changes are saved after exiting/reloading Unity.

Any hint on what I must do in my editor script to correctly save the animation curve automatically in my editor script ? (I can’t use SetDirty on AnimationCurve because it does’nt inherit from UnityEngine.Object but I’m not sure it’s the solution anyway)

Thanks,
Tom

I’m having similar troubles.

When I use my custom inspector editor to change positions of the transform, the transform updates, but it’s as if the animation isn’t aware of the change. I have to manually grab the transform handle to make the changes stick.

I’ve tried SetDirty on every component I can think of (the transform, the monobehaviour) but no dice.