📜  unity gui 样式颜色按钮 - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:32.487000             🧑  作者: Mango

代码示例1
#if UNITY_EDITOR
    [CustomEditor(typeof(MyClass))]
    public class MyClassEditor : Editor
    {
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            var style = new GUIStyle(GUI.skin.button);

            style.normal.textColor = Color.red;

            MyClass c = (MyClass)target;

            if (GUILayout.Button("Button Name", style))
            {
                c.MyMethod();
            }
        }
    }
#endif