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 float GetPropertyHeight(InspectableProperty property) { var height = EasyGUI.GetPropertyHeight(property, new GUIContent(property.DisplayName), false); if (property.IsExpanded) { for (int i = 0; i < property.ArraySize; i++) { var iterProp = property.GetArrayElementAtIndex(i); var displayName = new GUIContent(iterProp.DisplayName); if (ElementNameCallback != null) { iterProp.DisplayName = ElementNameCallback(i); displayName = iterProp.DisplayName == null ? GUIContent.none : new GUIContent(iterProp.DisplayName); } height += EasyGUI.GetInspectableObjectHeight(iterProp, displayName, IsDrawObjectReference); } height += 3 * EditorGUIUtility.singleLineHeight; } return(height); }