Override this method to specify how tall the GUI for this decorator is in pixels.
public float GetHeight(SerializedProperty property, GUIContent label, bool includeChildren) { float num1 = 0.0f; if (this.m_DecoratorDrawers != null && !this.isCurrentlyNested) { using (List <DecoratorDrawer> .Enumerator enumerator = this.m_DecoratorDrawers.GetEnumerator()) { while (enumerator.MoveNext()) { DecoratorDrawer current = enumerator.Current; num1 += current.GetHeight(); } } } float num2; if (this.propertyDrawer != null) { num2 = num1 + this.propertyDrawer.GetPropertyHeightSafe(property.Copy(), label ?? EditorGUIUtility.TempContent(property.displayName)); } else if (!includeChildren) { num2 = num1 + EditorGUI.GetSinglePropertyHeight(property, label); } else { property = property.Copy(); SerializedProperty endProperty = property.GetEndProperty(); num2 = num1 + EditorGUI.GetSinglePropertyHeight(property, label); bool enterChildren = property.isExpanded && EditorGUI.HasVisibleChildFields(property); while (property.NextVisible(enterChildren) && !SerializedProperty.EqualContents(property, endProperty)) { float num3 = num2 + ScriptAttributeUtility.GetHandler(property).GetHeight(property, EditorGUIUtility.TempContent(property.displayName), true); enterChildren = false; num2 = num3 + 2f; } } return(num2); }
public bool OnGUI(Rect position, SerializedProperty property, GUIContent label, bool includeChildren) { float height = position.height; position.height = 0.0f; if (this.m_DecoratorDrawers != null && !this.isCurrentlyNested) { using (List <DecoratorDrawer> .Enumerator enumerator = this.m_DecoratorDrawers.GetEnumerator()) { while (enumerator.MoveNext()) { DecoratorDrawer current = enumerator.Current; position.height = current.GetHeight(); float labelWidth = EditorGUIUtility.labelWidth; float fieldWidth = EditorGUIUtility.fieldWidth; current.OnGUI(position); EditorGUIUtility.labelWidth = labelWidth; EditorGUIUtility.fieldWidth = fieldWidth; position.y += position.height; height -= position.height; } } } position.height = height; if (this.propertyDrawer != null) { float labelWidth = EditorGUIUtility.labelWidth; float fieldWidth = EditorGUIUtility.fieldWidth; this.propertyDrawer.OnGUISafe(position, property.Copy(), label ?? EditorGUIUtility.TempContent(property.displayName)); EditorGUIUtility.labelWidth = labelWidth; EditorGUIUtility.fieldWidth = fieldWidth; return(false); } if (!includeChildren) { return(EditorGUI.DefaultPropertyField(position, property, label)); } Vector2 iconSize = EditorGUIUtility.GetIconSize(); bool enabled = GUI.enabled; int indentLevel = EditorGUI.indentLevel; int num = indentLevel - property.depth; SerializedProperty serializedProperty = property.Copy(); SerializedProperty endProperty = serializedProperty.GetEndProperty(); position.height = EditorGUI.GetSinglePropertyHeight(serializedProperty, label); EditorGUI.indentLevel = serializedProperty.depth + num; bool enterChildren = EditorGUI.DefaultPropertyField(position, serializedProperty, label) && EditorGUI.HasVisibleChildFields(serializedProperty); position.y += position.height + 2f; while (serializedProperty.NextVisible(enterChildren) && !SerializedProperty.EqualContents(serializedProperty, endProperty)) { EditorGUI.indentLevel = serializedProperty.depth + num; position.height = EditorGUI.GetPropertyHeight(serializedProperty, (GUIContent)null, false); EditorGUI.BeginChangeCheck(); enterChildren = ScriptAttributeUtility.GetHandler(serializedProperty).OnGUI(position, serializedProperty, (GUIContent)null, false) && EditorGUI.HasVisibleChildFields(serializedProperty); if (!EditorGUI.EndChangeCheck()) { position.y += position.height + 2f; } else { break; } } GUI.enabled = enabled; EditorGUIUtility.SetIconSize(iconSize); EditorGUI.indentLevel = indentLevel; return(false); }