#if UNITY_EDITOR using UnityEditor; using System; using System.Reflection; namespace AlicizaX.EventKit { [InitializeOnLoad] public static class EventContainerEditorReset { static EventContainerEditorReset() { EditorApplication.playModeStateChanged += OnPlayModeStateChanged; } private static void OnPlayModeStateChanged(PlayModeStateChange state) { if (state == PlayModeStateChange.ExitingPlayMode) ResetAllEventContainers(); } private static void ResetAllEventContainers() { foreach (var type in EventContainerRegistry.GetRegisteredTypes()) { MethodInfo resetMethod = type.GetMethod("Reset", BindingFlags.Public | BindingFlags.Static); resetMethod?.Invoke(null, null); } } } } #endif