Fix Color32 fields not being drawn in the inspector

This commit is contained in:
VladV 2022-07-03 09:57:53 +03:00
parent 90decd5941
commit 9a058da91a
2 changed files with 10 additions and 0 deletions

View File

@ -9,6 +9,7 @@ using UnityEngine;
[assembly: RegisterTriValueDrawer(typeof(FloatDrawer), TriDrawerOrder.Fallback)]
[assembly: RegisterTriValueDrawer(typeof(StringDrawer), TriDrawerOrder.Fallback)]
[assembly: RegisterTriValueDrawer(typeof(ColorDrawer), TriDrawerOrder.Fallback)]
[assembly: RegisterTriValueDrawer(typeof(Color32Drawer), TriDrawerOrder.Fallback)]
[assembly: RegisterTriValueDrawer(typeof(LayerMaskDrawer), TriDrawerOrder.Fallback)]
[assembly: RegisterTriValueDrawer(typeof(EnumDrawer<>), TriDrawerOrder.Fallback)]
[assembly: RegisterTriValueDrawer(typeof(Vector2Drawer), TriDrawerOrder.Fallback)]
@ -57,6 +58,14 @@ namespace TriInspector.Drawers
}
}
public class Color32Drawer : BuiltinDrawerBase<Color32>
{
protected override Color32 OnValueGUI(Rect position, GUIContent label, Color32 value)
{
return EditorGUI.ColorField(position, label, value);
}
}
public class LayerMaskDrawer : BuiltinDrawerBase<LayerMask>
{
protected override LayerMask OnValueGUI(Rect position, GUIContent label, LayerMask value)

View File

@ -47,6 +47,7 @@ namespace TriInspector.Utilities
type == typeof(Vector3Int) ||
type == typeof(Vector4) ||
type == typeof(Color) ||
type == typeof(Color32) ||
type == typeof(LayerMask) ||
type == typeof(Rect) ||
type == typeof(RectInt) ||