public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); List <PopupOption <string> > options = new List <PopupOption <string> >(); if (UnityObject.FindObjectOfType <Timekeeper>() != null) { Timekeeper timekeeper = Timekeeper.instance; foreach (GlobalClock globalClock in timekeeper .GetComponents <GlobalClock>() .Where(gc => !string.IsNullOrEmpty(gc.key))) { options.Add(new PopupOption <string>(globalClock.key)); } } PopupOption <string> selectedOption; if (options.Any(o => o.value == property.stringValue)) { selectedOption = new PopupOption <string>(property.stringValue); } else if (!string.IsNullOrEmpty(property.stringValue)) { selectedOption = new PopupOption <string>(property.stringValue, property.stringValue + " (Missing)"); } else { selectedOption = null; } PopupOption <string> noneOption = new PopupOption <string>(null, "None"); var currentProperty = property; position = EditorGUI.PrefixLabel(position, label); PopupGUI <string> .Render ( position, gc => ChangeValue(currentProperty, gc), options, selectedOption, noneOption, property.hasMultipleDifferentValues ); EditorGUI.EndProperty(); }