EDITOR: Accessing Built-in textures

Hi guys and gals,

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.

Thanks!

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.

@hpjohn: I can access the built-in skins already, and it has definitely helped, I just need the textures.

@Dantus: I assumed as much, I’ll just create a list of all loaded textures and access them that way. Would be nice if they had a simpler system though :stuck_out_tongue:

Thanks guys!

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

@hpjohn What I meant was that there are some built in textures that sent used in any skins or styles. The 2D manipulator dots, for instance.

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

A list of all the built-in EdtiorGUI icons in Unity. Use EditorGUIUtility.IconContent([icon name]) to access them can be found at A list of all the built-in EdtiorGUI icons in Unity. Use EditorGUIUtility.IconContent([icon name]) to access them. · GitHub these should work with EditorGUI.Find Texture as well

Texture warningIconTexture = EditorGUIUtility.IconContent("console.warnicon.sml").image;

Image warningIcon = new Image
{
    image = warningIconTexture,
    scaleMode = ScaleMode.ScaleToFit,
    style =
    {
        width = warningIconTexture.width,
        height = warningIconTexture.height
    },
    name = "warning-icon"
};