Complete reorga
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
using UnityEngine;
|
||||
using Unheimlich.Features.Portals;
|
||||
|
||||
namespace Unheimlich.Dev
|
||||
{
|
||||
public class PortalAudioDebugger : MonoBehaviour
|
||||
{
|
||||
private Portal _portal;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_portal = GetComponent<Portal>();
|
||||
}
|
||||
|
||||
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($"<color=green>[PortalDebug] RoomLoaded event fired on {gameObject.name}</color>");
|
||||
|
||||
if (_portal.LoadedRoomInstance != null)
|
||||
{
|
||||
AudioSource[] sources = _portal.LoadedRoomInstance.GetComponentsInChildren<AudioSource>();
|
||||
Debug.Log($"<color=green>[PortalDebug] Found {sources.Length} AudioSources in loaded room:</color>");
|
||||
|
||||
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($"<color=red>[PortalDebug] RoomUnloaded event fired on {gameObject.name}</color>");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user