Files
Cielonos/Assets/OtherPlugins/GraphicsCat/Modules/Common/PropertyAttributes/SeparatorDrawer.cs
SoulliesOfficial d15957c719 更新
2025-12-17 04:19:38 -05:00

31 lines
957 B
C#

#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace GraphicsCat
{
[CustomPropertyDrawer(typeof(SeparatorAttribute))]
public class SeparatorDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
var separator = (SeparatorAttribute)attribute;
var rect = new Rect(position.x, position.y + separator.Height / 2f + 1f, position.width, separator.Height);
EditorGUI.DrawRect(rect, Color.gray * 0.8f);
position.y += separator.Height + 2f + 3f;
EditorGUI.PropertyField(position, property, label, true);
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
var separator = (SeparatorAttribute)attribute;
return separator.Height + 2f + EditorGUI.GetPropertyHeight(property, label, true);
}
}
}
#endif