private float GetHelpBoxHeight() { InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)attribute; float minHeight = EditorGUIUtility.singleLineHeight * 2.0f; float desiredHeight = GUI.skin.box.CalcHeight(new GUIContent(infoBoxAttribute.Text), EditorGUIUtility.currentViewWidth); float height = Mathf.Max(minHeight, desiredHeight); return height; }
public override void OnGUI(Rect rect) { InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)attribute; float indentLength = NaughtyEditorGUI.GetIndentLength(rect); Rect infoBoxRect = new Rect( rect.x + indentLength, rect.y, rect.width - indentLength, GetHelpBoxHeight()); DrawInfoBox(infoBoxRect, infoBoxAttribute.Text, infoBoxAttribute.Type); }