Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

EditorGUI.GetPropertyHeight

static function GetPropertyHeight(property: SerializedProperty, label: GUIContent = null, includeChildren: bool = true): float;
static float GetPropertyHeight(SerializedProperty property, GUIContent label = null, bool includeChildren = true);
static def GetPropertyHeight(property as SerializedProperty, label as GUIContent = null, includeChildren as bool = true) as float

Parameters

propertyHeight of the property area.
labelDescriptive text or image.
includeChildrenShould the returned height include the height of child properties?

Description

Get the height needed for a PropertyField control.

The height is based on the type of the SerializedProperty, and inclues the height of all expanded children if the includeChildren parameter is set to true, which is the default. If the property has a custom PropertyDrawer, the function will return the height returned by that drawer. The includeChildren parameter is ignored in that case, as PropertyDrawers always include children.