public float GetHeight(SerializedProperty property, GUIContent label, bool includeChildren)
{
float height = 0;
if (m_DecoratorDrawers != null && !isCurrentlyNested)
{
foreach (DecoratorDrawer drawer in m_DecoratorDrawers)
{
height += drawer.GetHeight();
}
}
if (propertyDrawer != null)
{
// Retrieve drawer BEFORE increasing nesting.
PropertyDrawer drawer = propertyDrawer;
using (var nestingContext = IncrementNestingContext())
{
height += drawer.GetPropertyHeightSafe(property.Copy(), label ?? EditorGUIUtility.TempContent(property.localizedDisplayName, tooltip));
}
}
else if (!includeChildren)
{
height += EditorGUI.GetSinglePropertyHeight(property, label);
}
else if (UseReorderabelListControl(property))
{
ReorderableListWrapper reorderableList;
string key = ReorderableListWrapper.GetPropertyIdentifier(property);
// If collection doesn't have a ReorderableList assigned to it, create one and assign it
if (!s_reorderableLists.TryGetValue(key, out reorderableList))
{
reorderableList = new ReorderableListWrapper(property, label, true);
s_reorderableLists[key] = reorderableList;
}
reorderableList.Property = property;
height += s_reorderableLists[key].GetHeight();
return(height);
}
else
{
property = property.Copy();
// First property with custom label
height += EditorGUI.GetSinglePropertyHeight(property, label);
bool childrenAreExpanded = property.isExpanded && EditorGUI.HasVisibleChildFields(property);
// Loop through all child properties
var tc = EditorGUIUtility.TempContent(property.localizedDisplayName, tooltip);
if (childrenAreExpanded)
{
SerializedProperty endProperty = property.GetEndProperty();
while (property.NextVisible(childrenAreExpanded) && !SerializedProperty.EqualContents(property, endProperty))
{
height += ScriptAttributeUtility.GetHandler(property).GetHeight(property, tc, true);
childrenAreExpanded = false;
height += EditorGUI.kControlVerticalSpacing;
}
}
}
return(height);
}