AnimationCurve not refreshed in inspector

Since the old way of writing custom editors is used (which means direct access to the target property) you have to record the state of the object before you change it. Something like that:

      if (GUILayout.Button("Do something"))
      {
         Undo.RecordObject(target, "Done something");
         ((Sample)target).RemoveKey(0);
      }

You guessed wrong ^^. Please read the sticky code of conduct post at the top of the scripting forum. You essentially try to hijack the thread for your own purpose because in almost all cases the actual content is not the same. You usually have a slightly different code than what was in the OP. So you would now start posting your code to have your specific problem solved. And that’s hijacking a thread.

2 Likes