public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { BitsPerRangeAttribute attr = attribute as BitsPerRangeAttribute; if (attr.show) { return(attr.showLabel ? 66 : (66 - labelHeight)); //EditorGUI.GetPropertyHeight(property, label, true); } else { return(0); } }
public override void OnGUI(Rect r, SerializedProperty property, GUIContent label) { BitsPerRangeAttribute attr = attribute as BitsPerRangeAttribute; if (!attr.show) { return; } Rect ir = EditorGUI.IndentedRect(r); GUIContent emptyContent = new GUIContent("", attr.tooltip); float _labelheight = attr.showLabel ? labelHeight : 0; if (attr.showLabel) { GUI.Label(new Rect(ir.xMin, ir.yMin, ir.width - 1, 17), property.displayName + ":", "OL Title"); } GUI.Box(new Rect(ir.xMin, ir.yMin + _labelheight, ir.width, ir.height - 22), GUIContent.none, "GroupBox"); float padding = 6f; Rect row = new Rect(ir.xMin + padding, ir.yMin + _labelheight + padding, ir.width - padding * 2, 17); int value = property.intValue; //GUI.Label(row, property.displayName + ":", "BoldLabel"); row.width -= 28; int holdindent = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; property.intValue = EditorGUI.IntSlider(row, emptyContent, property.intValue, attr.min, attr.max); EditorGUI.indentLevel = holdindent; row.width += 28; GUI.Label(row, "bits", "RightLabel"); row.y += 17f; row.height = 17f; GUI.Label(row, attr.label + " " + ((uint)System.Math.Pow(2, property.intValue)).ToString()); }