private void DrawClones(string title, bool spawned, bool despawned, string propertyName) { var property = serializedObject.FindProperty(propertyName); var rect = EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField(string.Empty, GUILayout.Height(EditorGUI.GetPropertyHeight(property))); EditorGUILayout.EndVertical(); var rectF = rect; rectF.height = 16; tgt.GetClones(tempClones, spawned, despawned); property.isExpanded = EditorGUI.Foldout(rectF, property.isExpanded, GUIContent.none); UnityEditor.EditorGUI.IntField(rect, title, tempClones.Count); if (property.isExpanded == true) { foreach (var clone in tempClones) { EditorGUILayout.ObjectField(GUIContent.none, clone, typeof(GameObject), true); } } }