x


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

more ▼

asked Dec 05 '11 at 09:58 AM

solmyr gravatar image

solmyr
31 2 2 3

(comments are locked)
10|3000 characters needed characters left

0 answers: sort newest
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x75
x66
x57

asked: Dec 05 '11 at 09:58 AM

Seen: 577 times

Last Updated: Dec 05 '11 at 09:58 AM