public Text txt;
private void Awake()
{
Application.logMessageReceived += HandleLog;
}
void HandleLog(string condition, string stackTrace, LogType type)
{
if (type == LogType.Error || type == LogType.Exception || type == LogType.Log)
{
string message = "==================================\n";
if (type == LogType.Log)
{
message = string.Format("condition = {0} \n stackTrace = {1} \n type = {2}", condition, stackTrace,
type);
}
else
{
message = "<color=red>" + string.Format("condition = {0} \n stackTrace = {1} \n type = {2}", condition,
stackTrace,
type) + "</color>";
}
//log += message + "\n==================================\n";
txt.text += message + "\n";
}
}
Unity 屏幕文本实时显示Debug结果
最新推荐文章于 2023-06-29 10:59:40 发布