- Home /
Question by
ash9991win · Aug 24, 2018 at 06:05 AM ·
editor-scriptingpropertydrawer
Adding keys to animation curve at runtime does not update the graph
I have a scriptable object that has an animation curve in a separate class. I made a custom property drawer that shows the animation curve.
I have another function called AddKey that adds a new keyframe at a given time to the curve. The curve visualizer does not update when I add the key, but when I save the changes to the scriptable object and view it again after clicking away, the graph gets updated. This is in edit mode.
Example code:
public class CurveField {
public AnimationCurve weightCurve;
}
public classs CurveFieldPropertyDrawer : PropertyDrawer {
....
OnGuI(){
EditorGUI.PropertyField(weightCurveProperty...);
}
}
Comment
There is something like SetDirty on an element to force editor update the view, I remeber to use it extensively when I was creating editor extensions...
Your answer
![](https://koobas.hobune.stream/wayback/20220612173404im_/https://answers.unity.com/themes/thub/images/avi.jpg)