Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

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

EditorGUI.GetPropertyHeight

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static method GetPropertyHeight(property: SerializedProperty, includeChildren: bool): float;
public static float GetPropertyHeight(SerializedProperty property, bool includeChildren);
public static method GetPropertyHeight(type: SerializedPropertyType, label: GUIContent): float;
public static float GetPropertyHeight(SerializedPropertyType type, GUIContent label);
public static method GetPropertyHeight(property: SerializedProperty, label: GUIContent = null, includeChildren: bool = true): float;
public static float GetPropertyHeight(SerializedProperty property, GUIContent label = null, bool includeChildren = true);

Parameters

property Height of the property area.
label Descriptive text or image.
includeChildren Should 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.

Did you find this page useful? Please give it a rating: