void DrawAttributeListItems(Rect rect, int index, bool isActive, bool isFocused) { SerializedProperty element = attributeList.serializedProperty.GetArrayElementAtIndex(index); SerializedProperty typeSerialized = element.FindPropertyRelative("type"); AttributeType attributeType = null; if (typeSerialized != null) { attributeType = (AttributeType)typeSerialized.objectReferenceValue; } // On Change make sure AttributeType is not already in the list EditorGUI.BeginChangeCheck(); EditorGUI.PropertyField(new Rect(rect.x, rect.y, 225, EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("type"), GUIContent.none); if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < serializedDefaultAttributes.arraySize - 1; i++) { if (i != index && serializedDefaultAttributes.GetArrayElementAtIndex(i).FindPropertyRelative("type").objectReferenceValue == element.FindPropertyRelative("type").objectReferenceValue) { element.FindPropertyRelative("type").objectReferenceValue = null; EditorUtility.DisplayDialog("That Attribute Type has already been added", "Please select a different Attribute Type.", "OK"); break; } } } if (attributeType != null) { attributeType.DrawDefaultValueFields(rect, element); } }