提供DebugOverlay
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace OCES.Audio.Editor
|
||||||
|
{
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
public sealed class DebugInfoCollector : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
public static DebugInfoCollector Instance { get; private set; }
|
||||||
|
|
||||||
|
public Dictionary<uint, int> ClipConcurrentCount = new();
|
||||||
|
public List<ActiveSound> ActiveSounds = new();
|
||||||
|
public Dictionary<Type, int> ActiveStates = new();
|
||||||
|
readonly StringBuilder m_stringBuilder = new();
|
||||||
|
Text m_textComponent;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if ((bool)Instance && Instance != this)
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Instance = this;
|
||||||
|
|
||||||
|
this.m_textComponent = GetComponent<Text>();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
this.m_stringBuilder.Clear();
|
||||||
|
|
||||||
|
this.m_stringBuilder.AppendLine("Current States:");
|
||||||
|
foreach (KeyValuePair<Type, int> activeState in this.ActiveStates)
|
||||||
|
{
|
||||||
|
string enumName = Enum.GetName(activeState.Key, activeState.Value) ?? activeState.Value.ToString();
|
||||||
|
this.m_stringBuilder.AppendLine($"{activeState.Key.Name} is {enumName}");
|
||||||
|
}
|
||||||
|
this.m_stringBuilder.AppendLine();
|
||||||
|
|
||||||
|
this.m_stringBuilder.AppendLine("Clip Concurrent Count:");
|
||||||
|
foreach (KeyValuePair<uint, int> clipCount in this.ClipConcurrentCount)
|
||||||
|
{
|
||||||
|
this.m_stringBuilder.AppendLine($"{clipCount.Key} is playing {clipCount.Value}");
|
||||||
|
}
|
||||||
|
this.m_stringBuilder.AppendLine();
|
||||||
|
|
||||||
|
this.m_stringBuilder.Append("ActiveSounds:");
|
||||||
|
foreach (ActiveSound activeSound in this.ActiveSounds)
|
||||||
|
{
|
||||||
|
this.m_stringBuilder.AppendLine($"{activeSound.AudioObject.Id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.m_textComponent.text = this.m_stringBuilder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 393e3f1fc2824bcf81260ccf46ce9524
|
||||||
|
timeCreated: 1774410875
|
||||||
Reference in New Issue
Block a user