OnValueChanged is not called for non-odin drawers (bug?)

Issue #500 new
Igor Lepilov created an issue

I'm trying to use Property.OnValueChanged to check when value is changed from OdinAttributeDrawer, but I encounted an issue: if I have normal Unity's PropertyDrawer to draw field - OnValueChanged is not invoked when value changes.

Is that an intended behavior or is it a bug?

For now, I'm using such worrisome structure to check changes in current property:

EditorGUI.BeginChangeCheck();
this.CallNextDrawer(_label);
if (EditorGUI.EndChangeCheck())
{
   ValueModified();
   GUI.changed = false; //This way EndChangeCheck won't trigger in upper drawer
}

Inside ValueModified I have to either:

  • Call Property.ValueEntry.ApplyChanges() and then do stuff

  • Use EditorApplication.delayCall subscription (with unsubscription if OnValueChanged actually triggers).

  • Pass property's path to owner ScriptableObject so it can do stuff with that data in OnValidate

I don't really like such workarounds. Is it possible to do something about OnValueChanged?

I'm using Odin 2.0.15 with Unity 2018.3.6f1. Editor Only mode disabled. Windows 10

Comments (0)

  1. Log in to comment