Hi everyone,
I ran into a problem I cannot figure out.
I’m trying to stylize text input for Editor script and make custom background color.
It works well with “active” and “hover” states, but for “normal” and “focused” background remains gray.
GUIStyle customTextInputStyle = new GUIStyle(EditorStyles.textField);
customTextInputStyle.active.background = MakeText(2, 2, Color.green); // Background changes
customTextInputStyle.normal.background = MakeText(2, 2, Color.green); // Background doesn't change
customTextInputStyle.focused.background = MakeText(2, 2, Color.green); // Background doesn't change
public Texture2D MakeText(int width, int height, Color col)
{
Color[] pix = new Color[width * height];
for (int i = 0; i < pix.Length; ++i)
pix[i] = col;
Texture2D result = new Texture2D(width, height, TextureFormat.RGBA32, false);
result.SetPixels(pix);
result.Apply();
return result;
}