From d57d00aaff94db12e80266cb0fb9afa92135e69a Mon Sep 17 00:00:00 2001 From: TylerTemp Date: Sat, 19 Oct 2024 02:15:13 +0100 Subject: [PATCH] UIToolkit: Fix GetByXPath not save #78 --- Editor/Drawers/XPathDrawers/GetByXPathAttributeDrawer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Editor/Drawers/XPathDrawers/GetByXPathAttributeDrawer.cs b/Editor/Drawers/XPathDrawers/GetByXPathAttributeDrawer.cs index f12b52ad..09ad8da5 100644 --- a/Editor/Drawers/XPathDrawers/GetByXPathAttributeDrawer.cs +++ b/Editor/Drawers/XPathDrawers/GetByXPathAttributeDrawer.cs @@ -776,6 +776,7 @@ protected override void OnAwakeUIToolkit(SerializedProperty property, ISaintsAtt SetValue(initUserData.TargetProperty, initUserData.MemberInfo, parent, initUserData.CheckFieldResult.TargetValue); + initUserData.TargetProperty.serializedObject.ApplyModifiedProperties(); onValueChangedCallback.Invoke(initUserData.CheckFieldResult.TargetValue); } } @@ -789,6 +790,7 @@ protected override void OnAwakeUIToolkit(SerializedProperty property, ISaintsAtt object expectedData = initUserData.CheckFieldResult.TargetValue; // Debug.Log($"expectedData={expectedData}, targetProp={initUserData.TargetProperty.propertyPath} memberInfo={initUserData.MemberInfo.Name}"); SetValue(initUserData.TargetProperty, initUserData.MemberInfo, parent, expectedData); + initUserData.TargetProperty.serializedObject.ApplyModifiedProperties(); onValueChangedCallback.Invoke(expectedData); }; @@ -798,6 +800,7 @@ protected override void OnAwakeUIToolkit(SerializedProperty property, ISaintsAtt if(arrayIndex == -1) { SetValue(initUserData.TargetProperty, initUserData.MemberInfo, parent, null); + initUserData.TargetProperty.serializedObject.ApplyModifiedProperties(); onValueChangedCallback.Invoke(null); } else @@ -823,6 +826,7 @@ protected override void OnAwakeUIToolkit(SerializedProperty property, ISaintsAtt newValue => { SetValue(initUserData.TargetProperty, initUserData.MemberInfo, updatedParent, newValue); + initUserData.TargetProperty.serializedObject.ApplyModifiedProperties(); onValueChangedCallback.Invoke(newValue); }, updatedParent); }; @@ -911,6 +915,7 @@ protected override void OnUpdateUIToolkit(SerializedProperty property, ISaintsAt if (doResignNull || doResignValue) { SetValue(initUserData.TargetProperty, initUserData.MemberInfo, parent, checkResult.TargetValue); + initUserData.TargetProperty.serializedObject.ApplyModifiedProperties(); onValueChanged.Invoke(checkResult.TargetValue); checkResult = new CheckFieldResult {