BITKit/Src/Unity/Scripts/UX/Debuger/UXDebuger.cs

38 lines
1008 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
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();
}
}
}