public static Type ConstructableTypePopup <T>(Rect position, Type currentType, GUIStyle style = null) { Type[] subclasses = EditorReflector.FindConstructableSubClassesWithNull(typeof(T)); string[] subclassNames = EditorReflector.FindConstructableSubClassNamesWithNull(typeof(T)); int currentIndex = Array.IndexOf(subclasses, currentType); return(subclasses[EditorGUI.Popup(position, currentIndex, subclassNames, style ?? EditorStyles.popup)]); }
public static Type ConstructableTypePopup <T>(Rect position, Type currentType, Func <string, string> formatLabels, GUIStyle style = null) { Type[] subclasses = EditorReflector.FindConstructableSubClassesWithNull(typeof(T)); string[] subclassNames = EditorReflector.FindConstructableSubClassNamesWithNull(typeof(T)); for (int i = 0; i < subclassNames.Length; i++) { subclassNames[i] = formatLabels(subclassNames[i]); } int currentIndex = Array.IndexOf(subclasses, currentType); return(subclasses[EditorGUI.Popup(position, currentIndex, subclassNames, style ?? EditorStyles.popup)]); }