21 lines
804 B
C#
21 lines
804 B
C#
using RPGCoreCommon.Helpers.PropertyAttributeDrawers;
|
|
using UnityEditor;
|
|
using UnityEditor.UIElements;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace RPGCoreCommon.Helpers.Editor.PropertyAttributeDrawers
|
|
{
|
|
[CustomPropertyDrawer(typeof(LayerMaskAttribute))]
|
|
public class LayerMaskDrawer : PropertyDrawer
|
|
{
|
|
public override VisualElement CreatePropertyGUI(SerializedProperty property)
|
|
{
|
|
if (property.boxedValue is not int)
|
|
return new Label($"Field '{property.displayName}' is not INTEGER. {nameof(LayerMaskAttribute)} can be used only on <b>INTEGER</b> field.");
|
|
|
|
var layerMaskField = new LayerMaskField(property.displayName);
|
|
layerMaskField.BindProperty(property);
|
|
return layerMaskField;
|
|
}
|
|
}
|
|
} |