Skip to content

Commit 1f5d82a

Browse files
authored
Create WaitForSecondsDebugView.cs
1 parent 995618c commit 1f5d82a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

WaitForSecondsDebugView.cs

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

0 commit comments

Comments
 (0)