当前位置:网站首页>Encapsulate the debug function of unity
Encapsulate the debug function of unity
2022-04-23 07:47:00 【youth who behaves like an adult】
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();
}
版权声明
本文为[youth who behaves like an adult]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230626190923.html
边栏推荐
- 快排的练习
- C reads the registry
- NodeJS(一) 事件驱动编程
- FUEL: Fast UAV Exploration using Incremental Frontier Structure and Hierarchical Planning
- H5 local storage data sessionstorage, localstorage
- js之函数的两种声明方式
- Online Safe Trajectory Generation For Quadrotors Using Fast Marching Method and Bernstein Basis Poly
- Game assisted script development journey
- 颜色转换公式大全及转换表格(31种)
- c#读取INI文件和向ini文件写入数据
猜你喜欢

Use of command line parameter passing library argparse

Design optimization of MySQL database

'NPM' is not an internal or external command, nor is it a runnable program or batch file

FSM finite state machine

【NLP笔记】CRF原理初探

利用Lambda表达式解决c#文件名排序问题(是100大还是11大的问题)

H5 local storage data sessionstorage, localstorage

ABAP 7.4 SQL Window Expression

Window10版MySQL设置远程访问权限后不起效果

SAP DEBUG调试FOR IN、REDUCE等复杂的语句
随机推荐
基于NLP的软件安全研究(一)
Moment. Format of format method function in JS
移动端布局(3D转换、动画)
Double sided shader
Hot change scheme and dynamic update strategy of mobile game
将指定路径下的所有SVG文件导出成PNG等格式的图片(缩略图或原图大小)
One of event management
防抖和节流
中间人环境mitmproxy搭建
FUEL: Fast UAV Exploration using Incremental Frontier Structure and Hierarchical Planning
int a = 1存放在哪
js之什么是事件?事件三要素以及操作元素
FSM finite state machine
js之DOM事件
基于NLP的软件安全研究(二)
c#读取INI文件和向ini文件写入数据
Install and configure Taobao image NPM (cnpm)
快速排序
C#使用拉依达准则(3σ准则)剔除异常数据(.Net剔除一组数据中的奇异值)
【NLP笔记】CRF原理初探