public override void OnGUI(Rect r, SerializedProperty property, GUIContent label) { BitsPerRangeAttribute attr = attribute as BitsPerRangeAttribute; float _labelheight = attr.showLabel ? labelHeight : 0; if (attr.showLabel) { GUI.Label(new Rect(r.xMin, r.yMin, r.width - 1, 17), property.displayName + ":", "OL Title"); } GUI.Box(new Rect(r.xMin, r.yMin + _labelheight, r.width, r.height - 22), GUIContent.none, "GroupBox"); float padding = 6f; Rect row = new Rect(r.xMin + padding, r.yMin + _labelheight + padding, r.width - padding * 2, 17); int value = property.intValue; //GUI.Label(row, property.displayName + ":", "BoldLabel"); row.width -= 28; property.intValue = EditorGUI.IntSlider(row, GUIContent.none, property.intValue, attr.min, attr.max); 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()); }
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); } }