public override void OnInspectorGUI() { AutoAssignFields cb = (AutoAssignFields)target; int current = System.Array.IndexOf(components, cb.component); int selected = EditorGUILayout.Popup("Target Component", current, options); if (selected != current && selected >= 0) { cb.component = System.Array.Find(components, (MonoBehaviour m) => m.GetType().ToString().Equals(options[selected])); } if (GUILayout.Button("Assign")) { cb.Assign(); } EditorUtils.HorizontalLine(); showAssigned = EditorGUILayout.Foldout(showAssigned, "Auto Assigned Values", true); if (showAssigned) { ShowAssignments(); } serializedObject.ApplyModifiedProperties(); }