OnValueChanged doesn't seem to be called after doing an undo operation
Issue #427
resolved
OnValueChanged doesn't seem to be called after doing an undo (ctrl+z), the inspector does change correctly but the function isn't called.
Comments (2)
-
-
- changed status to resolved
This issue should be resolved as 2.1.6 and up.
- Log in to comment
I have the same problem on Unity 2018.3.0 with Odin 2.0.13.
In my situation, the OnValueChange method sets the enabled state of a couple child objects, so when the UNDO action fails to trigger the OnValueChange method, the child objects no longer match the field value.
I was able to get around the UNDO action failing to call OnValueChanged by using some UnityEditor.Undo.RecordObject() calls in the method, which is perhaps the right thing to do anyhow ... but those lines need to be wrapped in #if UNITY_EDITOR due to editor code being called in a MonoBehaviour.