#if UNITY_EDITOR || DEVELOPMENT_BUILD using UnityEngine; using Unheimlich.Features.Portals; namespace Unheimlich.Dev { public class PortalAudioDebugger : MonoBehaviour { private Portal _portal; private void Awake() { _portal = GetComponent(); } private void OnEnable() { if (_portal != null) { _portal.RoomLoaded += OnRoomLoadedDebug; _portal.RoomUnloaded += OnRoomUnloadedDebug; } } private void OnDisable() { if (_portal != null) { _portal.RoomLoaded -= OnRoomLoadedDebug; _portal.RoomUnloaded -= OnRoomUnloadedDebug; } } private void OnRoomLoadedDebug() { Debug.Log($"[PortalDebug] RoomLoaded event fired on {gameObject.name}"); if (_portal.LoadedRoomInstance != null) { AudioSource[] sources = _portal.LoadedRoomInstance.GetComponentsInChildren(); Debug.Log($"[PortalDebug] Found {sources.Length} AudioSources in loaded room:"); foreach (var source in sources) Debug.Log($" - {source.name} | Playing: {source.isPlaying} | Clip: {(source.clip != null ? source.clip.name : "NULL")}"); } } private void OnRoomUnloadedDebug() { Debug.Log($"[PortalDebug] RoomUnloaded event fired on {gameObject.name}"); } } } #endif