真Unity3D编辑器Editor二次开发

IMGUI Editor Label 改变颜色

分享一个很神奇的颜色

一开始这么写,以为不行的,

cs 复制代码
     private void OnGUI()(){
            GUILayout.Label("<color=red>name:</color>ffdasilufoi");
            //。。。。
}

结果这么写又好了,

cs 复制代码
        private GUIStyle m_tempFontStyle = new GUIStyle();

        void OnEnable(){

            m_tempFontStyle.normal.textColor = Color.yellow;

            m_tempFontStyle.fontSize = 20;

        }
cs 复制代码
     private void OnGUI()(){
            GUILayout.Label("<color=red>name:</color>ffdasilufoi",m_tempFontStyle);
            //。。。。
}

参考

这么写的出处,也是来自同网站的小哥:

EditorGUILayout改变Label的颜色_guilayout.label 设置字体颜色-CSDN博客

补充

cs 复制代码
void OnDetailInfoGUI(){
            GUILayout.Label("<color=red>name:</color>ffdasilufoi",m_tempFontStyle);
            GUILayout.Label("<color=#000000>size:</color>???",m_tempFontStyle);
            GUILayout.Label("<color=#0000ff>vertex:</color>11m",m_tempFontStyle);
            GUILayout.Label("triangles",m_tempFontStyle);
            GUILayout.Label("mat??",m_tempFontStyle);
            GUILayout.Label("Image;",m_tempFontStyle);
        }

奇怪的是???

#ff00ff 红+蓝居然是紫色?

相关推荐
Crazy Struggle1 小时前
.NET 中如何快速实现 List 集合去重?
c#·.net
xb11322 小时前
C#生产者-消费者模式
开发语言·c#
今晚打老虎z2 小时前
解决SQL Server 安装运行时针对宿主机内存不足2GB的场景
sqlserver·c#
esmap3 小时前
技术深度解析:ESMap引擎VS主流数字孪生竞品
人工智能·物联网·3d·编辑器·智慧城市·webgl
Traced back3 小时前
# C# WinForms 数据库清理系统基础知识与避坑指南
开发语言·数据库·c#
我要打打代码5 小时前
关于C#线程 任务
开发语言·数据库·c#
claider6 小时前
Vim User Manual 阅读笔记 usr_22.txt Finding the file to edit 多文件编辑浏览
笔记·编辑器·vim
小贺儿开发6 小时前
Unity3D 八大菜系连连看
游戏·unity·互动·传统文化
在路上看风景6 小时前
25. 屏幕像素和纹理像素不匹配
unity
Traced back6 小时前
# C# 基础语法完全指南
开发语言·c#