Skip to content

Instantly share code, notes, and snippets.

@ChemiKhazi
Created February 15, 2014 05:33
Show Gist options
  • Save ChemiKhazi/9014977 to your computer and use it in GitHub Desktop.
Save ChemiKhazi/9014977 to your computer and use it in GitHub Desktop.
Unity3D Enum Flags PropertyDrawer
[CustomPropertyDrawer(typeof(EnumType))]
public class PlayerUnitDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
property.intValue = (int) (EnumType) EditorGUI.EnumMaskField(position, "Property Name", (EnumType)property.intValue);
EditorGUI.EndProperty();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment