Hello! I’m making a custom editor for a scriptable object. Most of the properties you can change through property fields that I draw in the editor. However, some things I can’t do via a property field. I need to be able to add and remove items from a list. To do that I have buttons that execute functions on the target script. If I try to delete an item, the functions do work on the script, but the editor does not refresh and still shows all items. I need to click away, so that the inspector shows something else, and come back to the asset for the editor to show the list without the item that I removed. I have tried all of these things:
if (GUILayout.Button("X", GUILayout.Width(optWidth))){
musicMap.DeleteNote(i, j);
EditorUtility.SetDirty(musicMap);
EditorUtility.SetDirty(asset);
EditorUtility.SetDirty(this);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
AssetDatabase.LoadAllAssetsAtPath("Assets/Scripts/03 Data/01 Music");
serializedObject.ApplyModifiedProperties();
Repaint();
}
Thanks for any suggestions!