I’ve been working on converting some classes to use the new UnityEvent instead of an older in house implementation that relied on reflection.
The problem I came across is that the Delete button (that little “-” sign at the bottom of the list) is disabled when I use a custom editor that draws the event list.
Was this intentionally disabled by unity due to issues? when are we going to get this back?
To be clear, all i’m doing in my custom inspector is FindProperty(), followed by PropertyField(). Nothing more.
It is very frustrating that this simple supported functionality just doesn’t work for this case with no reason or explanation.
So after hours of messing around with this, it seems to be working again.
I guess the issue must have been me changing the editor code to test things, which somehow caused the internal list to get out of sync, and disallow deletion.
After clearing the entire list, and re-creating it, the button became active once again.
Same Unity version, on windows, if you create a new item, the button is enabled.
And upon further testing, I can confirm, if I change the editor code, and select the object again, the delete button is disabled once more, this time, until i select an element.
Seems that the selected index is updated when you create a new item, but once you load in a different object, or change the code causing a rebuild of the assemblies, the selected index is reset, disabling the button.
You can also see that if you have an item selected in the list (button enabled) and then change a different property (causing focus to be changed to another property altogether) the button stays enabled, since again, the selected index remains cached in the property drawer.