public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EnumFlagAttribute flagSettings = (EnumFlagAttribute)attribute; Enum targetEnum = GetBaseProperty<Enum>(property); string propName = flagSettings.enumName; if (string.IsNullOrEmpty(propName)) propName = property.name; EditorGUI.BeginProperty(position, label, property); #pragma warning disable CS0618 // Type or member is obsolete Enum enumNew = EditorGUI.EnumMaskField(position, propName, targetEnum); #pragma warning restore CS0618 // Type or member is obsolete property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType()); EditorGUI.EndProperty(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EnumFlagAttribute flagSettings = (EnumFlagAttribute)attribute; Enum targetEnum = GetBaseProperty <Enum>(property); string propName = flagSettings.enumName; if (string.IsNullOrEmpty(propName)) { propName = property.name; } EditorGUI.BeginProperty(position, label, property); Enum enumNew = EditorGUI.EnumFlagsField(position, propName, targetEnum); property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType()); EditorGUI.EndProperty(); }