当前位置:网站首页>自己封装unity的Debug函数
自己封装unity的Debug函数
2022-04-23 06:27:00 【老少年】
public static bool enableLog=true;
public static void LogWarning(string context)
{
if(enableLog)Debug.LogWarning(context);
}
public static void LogError(string context)
{
if (enableLog) Debug.LogError(context);
}
public static void Log(string context)
{
if (enableLog) Log(context,Color.white);
}
public static void Log(string context ,Color color)
{
if (enableLog) Debug.Log(string.Format("<color="+ ToHexColor(color) + ">{0}</color>", context));
}
private static string ToHexColor(Color color)
{
if (color==Color.white)
return "#000000";
string R = Convert.ToString((int)color.r*255, 16);
if (R == "0")
R = "00";
string G = Convert.ToString((int)color.g * 255, 16);
if (G == "0")
G = "00";
string B = Convert.ToString((int)color.b * 255, 16);
if (B == "0")
B = "00";
string HexColor = "#" + R + G + B;
return HexColor.ToUpper();
}
版权声明
本文为[老少年]所创,转载请带上原文链接,感谢
https://blog.csdn.net/laoshaonian/article/details/104826293
边栏推荐
猜你喜欢
How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
SAP 导出Excel文件打开显示:“xxx“的文件格式和扩展名不匹配。文件可能已损坏或不安全。除非您信任其来源,否则请勿打开。是否仍要打开它?
超级宝典&编程指南(红蓝宝书)-读书笔记
Design optimization of MySQL database
ogldev-读书笔记
keytool: command not found
js之DOM事件
王者荣耀-unity学习之旅
Date object (JS built-in object)
设置了body的最大宽度,但是为什么body的背景颜色还铺满整个页面?
随机推荐
【TED系列】一个习惯是如何改变我的一生
MySQL storage engine
Reflection on the systematic design of Android audio and video caching mechanism
Design optimization of MySQL database
ABAP 实现发布RESTful服务供外部调用示例
6.聚合函数和分组统计
js中对象的三种创建方式
手游性能优化
SAP pi / PO rfc2restful publishing RFC interface is a restful example (proxy indirect method)
How to judge whether a point is within a polygon (including complex polygons or a large number of polygons)
7. sub query
js之DOM事件
State synchronization and frame synchronization
给定区段范围内字符串自生成代码
The page displays the current time in real time
斐波拉去动态规划
js之节点操作,为什么要学习节点操作
简单理解==和equals,String为什么可以不用new
Redis connection error err auth < password > called without any password configured for the default user
FSM有限状态机