/// <summary> /// Draw a horizontal line. /// </summary> /// <param name="_height">Line height.</param> /// <param name="_width">Line width ; 0 is full width.</param> /// <param name="_color">Color of the line.</param> public static void HorizontalLine(float _height, float _width, Color _color) { // Get line rect Rect _position = EditorGUILayout.GetControlRect(false, _height + EditorGUIUtility.singleLineHeight); _position.y += (EditorGUIUtility.singleLineHeight / 2f) - 1; _position.height = _height; // Draw line EditorGUIEnhanced.HorizontalLine(_position, _width, _color); }
// Make your own GUI for the decorator public override void OnGUI(Rect _position) { HorizontalLineAttribute _attribute = (HorizontalLineAttribute)attribute; // Set position at the middle of the area and line height _position.y += (EditorGUIUtility.singleLineHeight / 2f) - 1; _position.height = _attribute.Height; // Draw line at rect EditorGUIEnhanced.HorizontalLine(_position, _attribute.Width, _attribute.Color.GetColor()); }