- Home /
What are the editor resources by name for EditorGUIUtility.Load Method?
According to http://docs.unity3d.com/ScriptReference/EditorGUIUtility.Load.html
Calling EditorGUIUtility.Load will try the built-in editor resources by name. I have found some at the following locations via some scripts I found online "icons/d_unityeditor.gameview.png", "icons/d_unityeditor.sceneview.png", and "icons/d_movetool.png"
but I believe there are more of them. I've been unable to locate the folder where they are hiding at.
Does anyone happen to know where the list of those names are? Or could help me find the folder with all the editor resources? I'm trying to make an editor tool and I'm specifically looking for the C# script image and the JS script image from Unity's internals but I don't know where to find them.
It may be possible to get what I'm looking for via AssetPreview.GetMiniTypeThumbnail which has helped me find other icons but it doesn't like being fed typeof(MonoBehaviour); and I'm not sure what else to try...
Any help with helping me find these images would be great, Thanks
/Applications/Unity/Unity.app/Contents/Resources/unity editor resources
???
and possibly you want icons/generated/js script icon.asset
and icons/generated/cs script icon.asset
, if my use of strings
is any help.
Cool! Now I just need to know how to check a gameObject to see if it has a cs script or a js script and this tool is ready to roll!
I think you are technically correct. Although I don't have a clue how'd you get inside that file and find out what's going on there./Applications/Unity/Unity.app/Contents/Resources/unity editor resources
That's not a file system address on Windows is it? I couldn't find it ... :s
Answer by vexe · Sep 17, 2014 at 07:21 AM
I don't think you need to know the location of the icons, nor their names if you want to get the preview for a certain object or type, nor if a script is JS or CS - you could just use AssetPreview.GetMiniThumbnail(UnityEngine.Object) and AssetPreview.GetMiniTypeThumbnail(System.Type)
If you still want the names, maybe you want to load the icons manually, I found this method in UnityEditorInternal.InternalEditorUtility
, gives you all the icon names you need!
public static Texture2D GetIconForFile(string fileName)
{
int num = fileName.LastIndexOf('.');
string text = (num != -1) ? fileName.Substring(num + 1).ToLower() : string.Empty;
string text2 = text;
switch (text2)
{
case "boo":
return EditorGUIUtility.FindTexture("boo Script Icon");
case "cginc":
return EditorGUIUtility.FindTexture("CGProgram Icon");
case "cs":
return EditorGUIUtility.FindTexture("cs Script Icon");
case "guiskin":
return EditorGUIUtility.FindTexture("GUISkin Icon");
case "js":
return EditorGUIUtility.FindTexture("Js Script Icon");
case "mat":
return EditorGUIUtility.FindTexture("Material Icon");
case "prefab":
return EditorGUIUtility.FindTexture("PrefabNormal Icon");
case "shader":
return EditorGUIUtility.FindTexture("Shader Icon");
case "txt":
return EditorGUIUtility.FindTexture("TextAsset Icon");
case "unity":
return EditorGUIUtility.FindTexture("SceneAsset Icon");
case "asset":
case "prefs":
return EditorGUIUtility.FindTexture("GameManager Icon");
case "anim":
return EditorGUIUtility.FindTexture("Animation Icon");
case "meta":
return EditorGUIUtility.FindTexture("MetaFile Icon");
case "ttf":
case "otf":
case "fon":
case "fnt":
return EditorGUIUtility.FindTexture("Font Icon");
case "aac":
case "aif":
case "aiff":
case "au":
case "mid":
case "midi":
case "mp3":
case "mpa":
case "ra":
case "ram":
case "wma":
case "wav":
case "wave":
case "ogg":
return EditorGUIUtility.FindTexture("AudioClip Icon");
case "ai":
case "apng":
case "png":
case "bmp":
case "cdr":
case "dib":
case "eps":
case "exif":
case "gif":
case "ico":
case "icon":
case "j":
case "j2c":
case "j2k":
case "jas":
case "jiff":
case "jng":
case "jp2":
case "jpc":
case "jpe":
case "jpeg":
case "jpf":
case "jpg":
case "jpw":
case "jpx":
case "jtf":
case "mac":
case "omf":
case "qif":
case "qti":
case "qtif":
case "tex":
case "tfw":
case "tga":
case "tif":
case "tiff":
case "wmf":
case "psd":
case "exr":
return EditorGUIUtility.FindTexture("Texture Icon");
case "3df":
case "3dm":
case "3dmf":
case "3ds":
case "3dv":
case "3dx":
case "blend":
case "c4d":
case "lwo":
case "lws":
case "ma":
case "max":
case "mb":
case "mesh":
case "obj":
case "vrl":
case "wrl":
case "wrz":
case "fbx":
return EditorGUIUtility.FindTexture("Mesh Icon");
case "asf":
case "asx":
case "avi":
case "dat":
case "divx":
case "dvx":
case "mlv":
case "m2l":
case "m2t":
case "m2ts":
case "m2v":
case "m4e":
case "m4v":
case "mjp":
case "mov":
case "movie":
case "mp21":
case "mp4":
case "mpe":
case "mpeg":
case "mpg":
case "mpv2":
case "ogm":
case "qt":
case "rm":
case "rmvb":
case "wmw":
case "xvid":
return EditorGUIUtility.FindTexture("MovieTexture Icon");
case "colors":
case "gradients":
case "curves":
case "curvesnormalized":
case "particlecurves":
case "particlecurvessigned":
case "particledoublecurves":
case "particledoublecurvessigned":
return EditorGUIUtility.FindTexture("ScriptableObject Icon");
}
return EditorGUIUtility.FindTexture("DefaultAsset Icon");
}
EDIT:
Not icons, but also relevant - some GUI internal styles including the toolbarSearchField
(the search field that's used in the hierarchy and project views)
// UnityEditor.EditorStyles
private void InitSharedStyles()
{
this.m_ColorPickerBox = this.GetStyle("ColorPickerBox");
this.m_InspectorBig = this.GetStyle("In BigTitle");
this.m_MiniLabel = this.GetStyle("miniLabel");
this.m_LargeLabel = this.GetStyle("LargeLabel");
this.m_BoldLabel = this.GetStyle("BoldLabel");
this.m_MiniBoldLabel = this.GetStyle("MiniBoldLabel");
this.m_WordWrappedLabel = this.GetStyle("WordWrappedLabel");
this.m_WordWrappedMiniLabel = this.GetStyle("WordWrappedMiniLabel");
this.m_WhiteLabel = this.GetStyle("WhiteLabel");
this.m_WhiteMiniLabel = this.GetStyle("WhiteMiniLabel");
this.m_WhiteLargeLabel = this.GetStyle("WhiteLargeLabel");
this.m_WhiteBoldLabel = this.GetStyle("WhiteBoldLabel");
this.m_MiniTextField = this.GetStyle("MiniTextField");
this.m_RadioButton = this.GetStyle("Radio");
this.m_MiniButton = this.GetStyle("miniButton");
this.m_MiniButtonLeft = this.GetStyle("miniButtonLeft");
this.m_MiniButtonMid = this.GetStyle("miniButtonMid");
this.m_MiniButtonRight = this.GetStyle("miniButtonRight");
this.m_Toolbar = this.GetStyle("toolbar");
this.m_ToolbarButton = this.GetStyle("toolbarbutton");
this.m_ToolbarPopup = this.GetStyle("toolbarPopup");
this.m_ToolbarDropDown = this.GetStyle("toolbarDropDown");
this.m_ToolbarTextField = this.GetStyle("toolbarTextField");
this.m_ToolbarSearchField = this.GetStyle("ToolbarSeachTextField");
this.m_ToolbarSearchFieldPopup = this.GetStyle("ToolbarSeachTextFieldPopup");
this.m_ToolbarSearchFieldCancelButton = this.GetStyle("ToolbarSeachCancelButton");
this.m_ToolbarSearchFieldCancelButtonEmpty = this.GetStyle("ToolbarSeachCancelButtonEmpty");
this.m_SearchField = this.GetStyle("SearchTextField");
this.m_SearchFieldCancelButton = this.GetStyle("SearchCancelButton");
this.m_SearchFieldCancelButtonEmpty = this.GetStyle("SearchCancelButtonEmpty");
this.m_HelpBox = this.GetStyle("HelpBox");
this.m_AssetLabel = this.GetStyle("AssetLabel");
this.m_AssetLabelPartial = this.GetStyle("AssetLabel Partial");
this.m_AssetLabelIcon = this.GetStyle("AssetLabel Icon");
this.m_SelectionRect = this.GetStyle("selectionRect");
this.m_MinMaxHorizontalSliderThumb = this.GetStyle("MinMaxHorizontalSliderThumb");
this.m_BoldFont = this.GetStyle("BoldLabel").font;
this.m_StandardFont = this.GetStyle("Label").font;
this.m_MiniFont = this.GetStyle("MiniLabel").font;
this.m_MiniBoldFont = this.GetStyle("MiniBoldLabel").font;
this.m_ProgressBarBack = this.GetStyle("ProgressBarBack");
this.m_ProgressBarBar = this.GetStyle("ProgressBarBar");
this.m_ProgressBarText = this.GetStyle("ProgressBarText");
this.m_FoldoutPreDrop = this.GetStyle("FoldoutPreDrop");
this.m_InspectorTitlebar = this.GetStyle("IN Title");
this.m_InspectorTitlebarText = this.GetStyle("IN TitleText");
this.m_ToggleGroup = this.GetStyle("BoldToggle");
this.m_NotificationText = this.GetStyle("NotificationText");
this.m_NotificationBackground = this.GetStyle("NotificationBackground");
this.m_Popup = (this.m_LayerMaskField = this.GetStyle("MiniPopup"));
this.m_TextField = (this.m_NumberField = this.GetStyle("textField"));
this.m_Label = this.GetStyle("ControlLabel");
this.m_ObjectField = this.GetStyle("ObjectField");
this.m_ObjectFieldThumb = this.GetStyle("ObjectFieldThumb");
this.m_Toggle = this.GetStyle("Toggle");
this.m_ToggleMixed = this.GetStyle("ToggleMixed");
this.m_ColorField = this.GetStyle("ColorField");
this.m_Foldout = this.GetStyle("Foldout");
this.m_FoldoutSelected = GUIStyle.none;
this.m_TextArea = new GUIStyle(this.m_TextField);
this.m_TextArea.wordWrap = true;
this.m_InspectorDefaultMargins = new GUIStyle();
this.m_InspectorDefaultMargins.padding = new RectOffset(14, 4, 0, 0);
this.m_InspectorFullWidthMargins = new GUIStyle();
this.m_InspectorFullWidthMargins.padding = new RectOffset(5, 4, 0, 0);
}
Answer by Wom · Oct 18, 2014 at 06:07 AM
This is not my list, I found it by Googling for "d_console.erroricon.png": https://gist.github.com/masa795/5797164
Answer by ktmarine1999 · Feb 01, 2017 at 09:28 AM
There is an Editor Script on the UnifyWiki called Show Built In Resources you can find it at http://wiki.unity3d.com/index.php/Show_Built_In_Resources
Copy/paste this code into a file called BuiltInResourcesWindow.cs, and put it in an Editor folder. Then select Window / Built-in styles and icons.
This will show an editor window with all of the built in styles and icons. Once you find the one you want click on the button, this will copy the code for that style or icon.
Then go to your script editor and past the code.
In your case for the C# script Icon EditorGUIUtility.FindTexture( "cs Script Icon" ) this will return the C# script icon as a texture.
Answer by Socapex · Feb 27, 2017 at 01:45 AM
I made a free extension to show builtin icons. https://www.assetstore.unity3d.com/en/#!/content/70496
Cheers
URL has changed: https://assetstore.unity.com/packages/tools/utilities/unity-internal-icons-70496 (For the next time the link breaks, it's called "Unity Internal Icons")