private void RegistEvent <T>(INotifyValueChanged <T> notify, FieldInfo fieldInfo) { #if UNITY_2019_1_OR_NEWER || UNITY_2019_OR_NEWER notify.RegisterValueChangedCallback((val) => { fieldInfo.SetValue(this.target, val.newValue); this.onDirty?.Invoke(); }); #else notify.OnValueChanged((val) => { fieldInfo.SetValue(this.target, val.newValue); this.onDirty?.Invoke(); }); #endif }
public static void RegisterValueChangedCallback <T>(this INotifyValueChanged <T> control, EventCallback <ChangeEvent <T> > callback) { control.OnValueChanged(callback); }