Is there a way of accessing the textures that come with the editor (editor chrome, icons, etc.) Without using Resources.FindObjectsOfTypeAll (); and enumerating through the results until you find what you’re looking for?
The above method includes all textures loaded into memory, including those that are in the current project.
Preferably I’d like a method along the lines of: EditorUtility.LoadBuiltinTexture (“sv_icon_name1”);
If no such method exists I can fallback on the Resources option, I’d just like to know if there is a Unity way of doing this.
EditorGUIUtility.GetBuiltinSkin( EditorSkin.xxxx);
Will get the skin for game/scene/inspector, these have a lot of custom styles, so you’ll have to check them yourself
Unfortunately there is not comfortable way to do that. You may e.g. access the icons through reflection, but as soon as Unity changes the api, you need to make some ugly changes. Creating editor extensions that fit nicely into Unity is pretty simple, but as soon as you try to dive in, this kind of issues slows you down a lot.
The textures are here:
skin.xxx.active.background
where xxx is ‘box’ or ‘button’ or ‘customstyle[0]’
and where active is active or hover or OnNormal…etc
EditorGUIUtility.FindTexture(“textureName”) is what you are looking for this gives you a Texture2D
or you can use
EditorGUIUtility.IconContent(“iconName”) this gives you the GUI content. This has an image that is a Texture.
For example
EditorGUIUtility.FindTexture(“Project”) will give you a folder icon
EditorGUIUtility.FindTexture(“console.warnicon.sml”) gives you a warning icon
EditorGUIUtility.IconContent(“iconName”).image as Texture2d