Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetPropertyHeight

Get the height needed for a EditorGUI.PropertyField control.
Read time 2 minutesLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor

GetPropertyHeight(SerializedPropertyType, GUIContent)

Get the height needed for a EditorGUI.PropertyField control.
public static float GetPropertyHeight(SerializedPropertyType type, GUIContent label)

Parameters


Descriptive text or image.

Returns

Type

Description

float

Remarks

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.

GetPropertyHeight(SerializedProperty, bool)

Get the height needed for a EditorGUI.PropertyField control.
public static float GetPropertyHeight(SerializedProperty property, bool includeChildren)

Parameters

Height of the property area.

includeChildren

Should the returned height include the height of child properties?

Returns

Type

Description

float

Remarks

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.

GetPropertyHeight(SerializedProperty, GUIContent, bool)

Get the height needed for a EditorGUI.PropertyField control.
public static float GetPropertyHeight(SerializedProperty property, GUIContent label, bool includeChildren)

Parameters

Height of the property area.

Descriptive text or image.

includeChildren

Should the returned height include the height of child properties?

Returns

Type

Description

float

Remarks

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.