public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { FlagEnumAttribute flagEnumAttribute = (FlagEnumAttribute)attribute; string propName = flagEnumAttribute.enumName; if (string.IsNullOrEmpty(propName)) { propName = property.name; } property.intValue = EditorGUI.MaskField(position, propName, property.intValue, property.enumDisplayNames); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { FlagEnumAttribute flagSettings = (FlagEnumAttribute)attribute; Enum targetEnum = GetBaseProperty <Enum>(property); string propName = ObjectNames.NicifyVariableName(flagSettings.enumName); if (string.IsNullOrEmpty(propName)) { propName = ObjectNames.NicifyVariableName(property.name); } EditorGUI.BeginProperty(position, label, property); Enum enumNew = EditorGUI.EnumFlagsField(position, propName, targetEnum); property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType()); EditorGUI.EndProperty(); }