mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-24 09:08:23 -05:00
46a526c666
- Fixed and rearranged StackTraces compiler flags
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
#if UNITY_EDITOR
|
|
using System.Diagnostics;
|
|
using System.Collections.ObjectModel;
|
|
using System.Collections.Generic;
|
|
|
|
namespace UnityAtoms
|
|
{
|
|
public static class StackTraces
|
|
{
|
|
private static Dictionary<int, ObservableCollection<StackTraceEntry>> _stackTracesById = new Dictionary<int, ObservableCollection<StackTraceEntry>>();
|
|
|
|
public static void AddStackTrace(int id, StackTraceEntry stackTrace)
|
|
{
|
|
if (AtomPreferences.IsDebugModeEnabled)
|
|
{
|
|
GetStackTraces(id).Insert(0, stackTrace);
|
|
}
|
|
}
|
|
|
|
public static void ClearStackTraces(int id) => GetStackTraces(id).Clear();
|
|
|
|
public static ObservableCollection<StackTraceEntry> GetStackTraces(int id)
|
|
{
|
|
if (!_stackTracesById.ContainsKey(id))
|
|
{
|
|
_stackTracesById.Add(id, new ObservableCollection<StackTraceEntry>());
|
|
}
|
|
else if (_stackTracesById[id] == null)
|
|
{
|
|
_stackTracesById[id] = new ObservableCollection<StackTraceEntry>();
|
|
}
|
|
|
|
return _stackTracesById[id];
|
|
}
|
|
}
|
|
}
|
|
#endif
|