In the traditional editor code, you can restrict Enum choices in an EditorGUILayout.EnumPopup by passing in a delegate method to the popup that tests each value, for example:
ItemCategory newCategory = (ItemCategory)EditorGUILayout.EnumPopup(new GUIContent("Category"), category,
IsCategorySelectable, false);
protected virtual bool IsCategorySelectable(Enum location)
{
ItemCategory candidate = (ItemCategory)location;
return candidate!=ItemCategory.Special;
}
In my custom editors, I use this to disable elements that don’t make sense for that particular item. The item still appears in the popup, but it is grayed out and unselectable.
I would like to find a way to do this using the EnumField in UIElements.