using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class ErrowView : MonoBehaviour {
//错误详情
private List<String> m_logEntries = new List<String>();
//是否显示错误窗口
private bool m_IsVisible = false;
//窗口显示区域
private Rect m_WindowRect = new Rect(0, 0, Screen.width, Screen.height);
//窗口滚动区域
private Vector2 m_scrollPositionText = Vector2.zero;
private void Start()
{
// 关掉Log
#if !UNITY_EDITOR
Debug.unityLogger.logEnabled = false;
#endif
//监听错误
Application.logMessageReceived += (condition, stackTrace, type) =>
{
if (type == LogType.Exception || type == LogType.Error)
{
if (!m_IsVisible)
{
m_IsVisible = true;
}
m_logEntries.Add(string.Format("{0}\n{1}", condition, stackTrace));
}
};
Debug.LogError("momo");
Unity LogError UI
最新推荐文章于 2024-07-10 13:38:39 发布