Fix LayerMask drawer

This commit is contained in:
VladV 2023-10-25 18:05:09 +04:00
parent 6bbde41299
commit 0e23ca4a42

View File

@ -2,6 +2,7 @@
using TriInspector;
using TriInspector.Drawers;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
[assembly: RegisterTriValueDrawer(typeof(IntegerDrawer), TriDrawerOrder.Fallback)]
@ -50,6 +51,7 @@ namespace TriInspector.Drawers
return EditorGUI.IntField(position, label, value);
}
}
public class LongDrawer : BuiltinDrawerBase<long>
{
protected override long OnValueGUI(Rect position, GUIContent label, long value)
@ -57,6 +59,7 @@ namespace TriInspector.Drawers
return EditorGUI.LongField(position, label, value);
}
}
public class FloatDrawer : BuiltinDrawerBase<float>
{
protected override float OnValueGUI(Rect position, GUIContent label, float value)
@ -85,7 +88,11 @@ namespace TriInspector.Drawers
{
protected override LayerMask OnValueGUI(Rect position, GUIContent label, LayerMask value)
{
return EditorGUI.LayerField(position, label, value);
var mask = InternalEditorUtility.LayerMaskToConcatenatedLayersMask(value);
var layers = InternalEditorUtility.layers;
position = EditorGUI.PrefixLabel(position, label);
return EditorGUI.MaskField(position, mask, layers);
}
}