This commit is contained in:
CortexCore
2024-07-05 15:07:38 +08:00
parent 87eae34f4b
commit b3768a7aa8
5 changed files with 36 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -5,11 +6,33 @@ using BITKit;
using UnityEngine.UIElements;
using Cysharp.Threading.Tasks;
using System.Linq;
using System.Text;
namespace BITKit.UX
{
public sealed class UXDebuger : MonoBehaviour
{
private readonly StringBuilder _logBuilder=new();
private void OnEnable()
{
Application.logMessageReceivedThreaded += OnLog;
}
private void OnDisable()
{
Application.logMessageReceivedThreaded -= OnLog;
}
private void OnLog(string condition, string stacktrace, LogType type)
{
_logBuilder.Append(condition);
}
private void OnGUI()
{
GUILayout.BeginArea(new Rect(0, 0, Screen.width, Screen.height));
GUILayout.BeginVertical();
GUILayout.Label(_logBuilder.ToString());
GUILayout.EndVertical();
GUILayout.EndArea();
}
}
}