先看效果:
可随意输出自定义颜色的内容;
实现如下:
/// <summary>
/// log the warring message by yellow front
/// </summary>
/// <param name="warringMsg"></param>
public static void LogWarring(string warringMsg)
{
Debug.Log($"-><color=#CD8500>{warringMsg}</color>");
}
/// <summary>
/// log the error message by red front
/// </summary>
/// <param name="errorMsg"></param>
public static void LogError(string errorMsg)
{
Debug.Log($"-><color=#8B0000>{errorMsg}</color>");
}
/// <summary>
/// log the tip infomation by green front
/// </summary>
/// <param name="tipMsg"></param>
public static void LogTip(string tipMsg)
{
Debug.Log($"-><color=#008B00>{tipMsg}</color>");
}
至于十六进制的颜色码怎么找,拜访度娘。