private float ElementHeightCallback(SerializedProperty property, int index) { var height = 3f; var iterProp = property.GetArrayElementAtIndex(index); if (iterProp.isExpanded || !ElementHeights.ContainsKey(index)) { var displayName = new GUIContent(iterProp.displayName); if (ElementNameCallback != null) { var elementName = ElementNameCallback(index); displayName = elementName == null ? GUIContent.none : new GUIContent(elementName); } if (iterProp.IsInspectableObjectData()) { height += EasyGUI.GetInspectableObjectHeight(iterProp, IsDrawObjectReference); } else { height += EasyGUI.GetPropertyFieldHeight(iterProp, displayName, IsDrawObjectReference); } if (!iterProp.isExpanded) { ElementHeights.Add(index, height); } } else { height = ElementHeights[index]; } return(height); }
public override float GetPropertyHeight(SerializedProperty property, GUIContent label) { // Try to get the sortable list this property belongs to ReorderableListData listData = null; if (listIndex.Count > 0) { listData = listIndex.Find(data => property.propertyPath.StartsWith(data.Parent)); } return(listData != null?listData.GetPropertyHeight(property) : EasyGUI.GetPropertyFieldHeight(property, label, property.isExpanded)); }