public static bool PropertyField(SerializedProperty property, GUIContent label, bool includeChildren, params GUILayoutOption[] options) { if (includeChildren || property.propertyType == SerializedPropertyType.Generic) { property.isExpanded = EditorGUILayout.Foldout(property.isExpanded, property.displayName); if (includeChildren && property.isExpanded) { foreach (SerializedProperty childProperty in property) { PropertyField(childProperty, new GUIContent(property.displayName), false, options); } } return(false); } Rect position = EditorGUILayout.GetControlRect(label.text.Length > 0, EditorGUI.GetPropertyHeight(property), options); CustomEditorGUI.PropertyField(position, property, label, includeChildren); return(property.hasChildren && property.isExpanded && !includeChildren); }