Skip to content

Commit dbf3cfb

Browse files
committed
fix: added a workaround for huge icons in the advanced dropdown for anything below 2021
1 parent 7a7232a commit dbf3cfb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Editor/Utilities/IconUtility.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace TNRD
55
{
66
internal static class IconUtility
77
{
8+
#if UNITY_2021_1_OR_NEWER
89
private static Texture2D folderIcon;
910

1011
public static Texture2D FolderIcon
@@ -54,5 +55,34 @@ public static Texture2D GetIconForObject(Object obj)
5455
{
5556
return EditorGUIUtility.GetIconForObject(obj);
5657
}
58+
#else
59+
// "Fix" for 2020 as the icons are 256x256 in size and the AdvancedDropDown fills the space as much as it can
60+
public static Texture2D FolderIcon => null;
61+
62+
private static Texture2D scriptIcon;
63+
64+
public static Texture2D ScriptIcon
65+
{
66+
get
67+
{
68+
if (scriptIcon == null)
69+
scriptIcon = (Texture2D)EditorGUIUtility.IconContent("cs Script Icon").image;
70+
71+
return scriptIcon;
72+
}
73+
}
74+
75+
public static Texture2D GameObjectIcon => null;
76+
77+
public static Texture2D GetIconForObject(string path)
78+
{
79+
return null;
80+
}
81+
82+
public static Texture2D GetIconForObject(Object obj)
83+
{
84+
return null;
85+
}
86+
#endif
5787
}
5888
}

0 commit comments

Comments
 (0)