Quite a while ago I had problems with enums in the inspector, i.e. they were not being set properly and I got exceptions when trying to change them
changed this code:
public class EnumTypeDrawer : ITypeDrawer {
public bool HandlesType(Type type) {
return type.IsEnum;
}
public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) {
if (memberType.IsDefined(typeof(FlagsAttribute), false)) {
return EditorGUILayout.EnumMaskField(memberName, (Enum)value);
}
return EditorGUILayout.EnumPopup(memberName, (Enum)value);
}
}
to
public class EnumTypeDrawer : ITypeDrawer
{
public bool HandlesType (Type type)
{
return type.IsEnum;
}
public object DrawAndGetNewValue (Type memberType, string memberName, object value, object target)
{
if (memberType.IsDefined (typeof (FlagsAttribute), false))
{
return EditorGUILayout.EnumFlagsField (memberName, (Enum) value);
}
return EditorGUILayout.EnumPopup (memberName, (Enum) value);
}
}
and everything worked as expected. EnumFlagsField (latest api) has the same signature as the old one but is broken now. Has anyone else had this issue before?
Quite a while ago I had problems with enums in the inspector, i.e. they were not being set properly and I got exceptions when trying to change them
changed this code:
to
and everything worked as expected. EnumFlagsField (latest api) has the same signature as the old one but is broken now. Has anyone else had this issue before?