using System.Collections.Generic; using UnityEditor; namespace BrewMonster { public static class DebugRegistry { private static readonly HashSet targets = new HashSet(); static DebugRegistry() { EditorApplication.playModeStateChanged += OnPlayModeChanged; } private static void OnPlayModeChanged(PlayModeStateChange state) { if (state == PlayModeStateChange.ExitingEditMode || state == PlayModeStateChange.EnteredPlayMode || state == PlayModeStateChange.EnteredEditMode) { Clear(); UnityEngine.Debug.Log("[DebugRegistry] Cleared"); } } public static void Enable(object o) { if (o == null) return; targets.Add(o); } public static void Disable(object o) { if (o == null) return; targets.Remove(o); } public static bool IsEnabled(object o) { return o != null && targets.Contains(o); } public static void Clear() { targets.Clear(); } } }