UI Elements not update inspector
Im try to create custom inspector for scriptableObject with UI Elements. All ok, i can change values in list, and SO save this changes. But inspector dont update my changes, im need to reselect SO in projectfolder for view my changes.
[CustomEditor(typeof(List_SO))] public class SO_UI : Editor { ScrollView m_TasksContainer; SerializedProperty _listProperty; bool m_popupSearchFieldOn;
public override VisualElement CreateInspectorGUI()
{
serializedObject.Update();
_listProperty = serializedObject.FindProperty("firstLists");
var root = new VisualElement();
root.Add(new Button(() => Test()));
for (int i = 0; i < _listProperty.arraySize; i++)
{
SerializedProperty property = _listProperty.GetArrayElementAtIndex(i);
root.Add(new PropertyField(property));
}
serializedObject.ApplyModifiedProperties();
return root;
}
public void Test()
{
Debug.Log("new void test");
_listProperty.arraySize += 1;
}
what wrong with my code?
Comment