1.6.0: Added FieldLabelFromType, StringToAnimationClipName and SingleSelectionFlag
This commit is contained in:
parent
7d99d62e11
commit
9faacb6291
15 changed files with 215 additions and 6 deletions
28
Editor/Drawers/SingleSelectionFlagAttributeDrawer.cs
Normal file
28
Editor/Drawers/SingleSelectionFlagAttributeDrawer.cs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
using Module.Inspector.Editor.Utilities;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.Inspector.Editor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(SingleSelectionFlagAttribute))]
|
||||
internal sealed class SingleSelectionFlagAttributeDrawer : DrawerPropertyDrawer
|
||||
{
|
||||
public override bool Draw(Rect position, DrawerPropertyAttribute attribute, SerializedProperty property, GUIContent label, EditorPropertyUtility.Result result)
|
||||
{
|
||||
if (property.propertyType != SerializedPropertyType.Enum)
|
||||
return false;
|
||||
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
{
|
||||
property.enumValueIndex = EditorGUI.Popup(position, label.text, property.enumValueIndex, property.enumDisplayNames);
|
||||
}
|
||||
EditorGUI.EndProperty();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string GetErrorMessage(SerializedProperty property)
|
||||
{
|
||||
return "Only supports enum";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue