rabidus-test/Assets/LogHandler.cs

26 lines
603 B
C#
Raw Permalink Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LogHandler : MonoBehaviour
{
private void OnEnable()
{
Application.logMessageReceived += LogCallback;
}
private void LogCallback(string condition, string stackTrace, LogType type)
{
if (type == LogType.Exception)
{
System.Diagnostics.StackTrace sTrace = new System.Diagnostics.StackTrace();
Debug.LogError(sTrace.ToString());
}
}
private void OnDisable()
{
Application.logMessageReceived -= LogCallback;
}
}