-
Notifications
You must be signed in to change notification settings - Fork 0
/
WaitForSecondsDebugView.cs
45 lines (37 loc) · 1.21 KB
/
WaitForSecondsDebugView.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// ReSharper disable InvertIf
// ReSharper disable CheckNamespace
// ReSharper disable UnusedMember.Global
using UnityEngine;
using System.Collections.Generic;
using AbyssMoth.Internal.Codebase.Runtime._MainMenuModule.User;
namespace AbyssMoth
{
// NOTE: Dependency (https://github.com/RimuruDev/MonoSingleton.git)
public class WaitForSecondsDebugView : MonoSingleton<WaitForSecondsDebugView>
{
#if UNITY_EDITOR
[SerializeField] private bool enableDebugView = true;
[SerializeField] private List<float> cachedTimes = new();
public void AddEntry(float time)
{
if (!cachedTimes.Contains(time))
{
cachedTimes.Add(time);
cachedTimes.Sort();
}
}
public void RemoveEntry(float time) =>
cachedTimes.Remove(time);
private void OnGUI()
{
if (!enableDebugView)
return;
GUILayout.BeginArea(new Rect(10, 10, 300, 500));
GUILayout.Label("WaitForSeconds Cache Debug View:");
foreach (var time in cachedTimes)
GUILayout.Label($"Time: {time} seconds");
GUILayout.EndArea();
}
#endif
}
}