///Get icon for type public static Texture GetTypeIcon(MemberInfo info, bool fallbackToDefault = true) { // if (!EditorGUIUtility.isProSkin){ return null; } if (info == null) { return(null); } var type = info is Type ? info as Type : info.ReflectedType; if (type == null) { return(null); } Texture texture = null; if (typeIcons.TryGetValue(type.FullName, out texture)) { if (texture != null) { if (texture.name != DEFAULT_TYPE_ICON_NAME || fallbackToDefault) { return(texture); } } return(null); } if (texture == null) { if (type.IsEnumerableCollection()) { var elementType = type.GetEnumerableElementType(); if (elementType != null) { texture = GetTypeIcon(elementType); } } } if (typeof(UnityEngine.Object).IsAssignableFrom(type)) { texture = AssetPreview.GetMiniTypeThumbnail(type); if (texture == null && (typeof(MonoBehaviour).IsAssignableFrom(type) || typeof(ScriptableObject).IsAssignableFrom(type))) { texture = EditorGUIUtility.ObjectContent(EditorUtils.MonoScriptFromType(type), null).image; if (texture == null) { texture = Icons.csIcon; } } } if (texture == null) { texture = Resources.Load <Texture>(IMPLICIT_ICONS_PATH + type.FullName); } ///Explicit icons not in dark theme if (EditorGUIUtility.isProSkin) { if (texture == null) { var iconAtt = type.RTGetAttribute <IconAttribute>(true); if (iconAtt != null) { texture = GetTypeIcon(iconAtt, null); } } } if (texture == null) { var current = type.BaseType; while (current != null) { texture = Resources.Load <Texture>(IMPLICIT_ICONS_PATH + current.FullName); current = current.BaseType; if (texture != null) { break; } } } if (texture == null) { texture = Resources.Load <Texture>(IMPLICIT_ICONS_PATH + DEFAULT_TYPE_ICON_NAME); } typeIcons[type.FullName] = texture; if (texture != null) //it should not be { if (texture.name != DEFAULT_TYPE_ICON_NAME || fallbackToDefault) { return(texture); } } return(null); }