Hey all,
I am trying to duplicate the appearance of the standard Unity Settings Icon that appears to the right of each component in the inspector. It is a small gear with an arrow next to it. I would imagine there is a proper built in editor style that matches this but I just can’t seem to find it!
Any tips? I can get pretty close but not xact, and I really want exact to provide a cohesive artist experience.
This doesn’t seem to work for me. It returns the black version on the dark theme when I would expect the grey version. Is there something above this I am missing to enable the auto adjust feature?
Hmmm. Are you sure you’re using the correct icon when making the button? What Unity version are you on? It works for me in Unity 2018 anyway, and I’m using dark mode (also tested light mode).
The full code I used to make the button:
var popupStyle = GUI.skin.FindStyle("IconButton");
var popupIcon = EditorGUIUtility.IconContent("_Popup");
var buttonRect = EditorGUILayout.GetControlRect(false, 20f, GUILayout.MaxWidth(20f));
if (GUI.Button(buttonRect, popupIcon, popupStyle))
{
//Stuff that happens when you click the button
}
It also worked using a EditorGUILayout.DropdownButton when I tried it.
I’m doing much the same, though using GUILayout rather than handle the rects myself. The only real difference is I am getting the IconButton skin from the Inspector skin, but I tried it your way with the same result.
Full dropdowns do look correct per skin. It’s just this icon by itself that I want does not.