using UnityEngine; namespace Unheimlich.Audio { public class AudioSourceInspector : MonoBehaviour { [Header("Debug Settings")] [SerializeField] private float _logInterval = 1f; private AudioSource _source; private float _lastLogTime; private void Awake() { _source = GetComponent(); } private void Update() { if (_source == null) return; if (Time.time - _lastLogTime >= _logInterval) { LogAudioSourceState(); _lastLogTime = Time.time; } } private void OnEnable() { Debug.Log($"[AudioInspector] OnEnable called on {gameObject.name}"); if (_source != null) LogAudioSourceState(); } private void OnDisable() { Debug.Log($"[AudioInspector] OnDisable called on {gameObject.name}"); if (_source != null) LogAudioSourceState(); } private void LogAudioSourceState() { if (_source == null) { Debug.LogWarning($"[AudioInspector] No AudioSource on {gameObject.name}"); return; } string clipName = _source.clip != null ? _source.clip.name : "NULL"; Debug.Log($"[AudioInspector] {gameObject.name} | " + $"Clip: {clipName} | " + $"Time: {_source.time:F2}s | " + $"isPlaying: {_source.isPlaying} | " + $"enabled: {_source.enabled} | " + $"volume: {_source.volume:F2} | " + $"mute: {_source.mute} | " + $"loop: {_source.loop} | " + $"Active: {gameObject.activeInHierarchy}"); } } }