扩展编辑器的颜色
1 通过GUIStyle的方式
2 通过GUI来改变
private void DrawTestColor()
{
GUILayout.Label("Title: Color");
GUILayout.Space(4);
// by style
GUIStyle myStyle;
myStyle = new GUIStyle(GUI.skin.label);
myStyle.normal.textColor = Color.red;
myStyle.fontSize = 14;
GUILayout.Label("by GUIStyle", myStyle);
myStyle = new GUIStyle(GUI.skin.textField);
myStyle.normal.background = null;
myStyle.fontSize = 13;
testIntColor = EditorGUILayout.IntField("IntField test", testIntColor, myStyle);
// BY gui
Color saveContent = GUI.contentColor;
Color saveBk = GUI.backgroundColor;
GUI.contentColor = Color.blue;
GUI.backgroundColor = Color.red;
GUILayout.Label("by GUI");
GUI.contentColor = saveContent;
testIntColor = EditorGUILayout.IntField("IntField test", testIntColor);
GUI.backgroundColor = Color.green;
if (GUILayout.Button("按钮"))
{
}
GUI.backgroundColor = saveBk;
}