com.alicizax.unity.entry/Runtime/GameAppStaticMemberReset.cs
2025-09-02 19:05:36 +08:00

58 lines
1.1 KiB
C#

#if UNITY_EDITOR
using UnityEditor;
internal static class GameAppStaticMemberReset
{
static GameAppStaticMemberReset()
{
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
}
private static void OnPlayModeStateChanged(PlayModeStateChange state)
{
if (state == PlayModeStateChange.ExitingPlayMode)
ResetAllEventContainers();
}
private static void ResetAllEventContainers()
{
GameApp._base = null;
#if ALICIZAX_AUDIO_SUPPORT
GameApp._audio = null;
#endif
#if ALICIZAX_EVENT_SUPPORT
GameApp._event = null;
#endif
#if ALICIZAX_FSM_SUPPORT
GameApp._fsm = null;
#endif
#if ALICIZAX_LOCALIZATION_SUPPORT
GameApp._localization = null;
#endif
#if ALICIZAX_NETWORK
GameApp._network = null;
#endif
GameApp._objectPool = null;
#if ALICIZAX_RESOURCE_SUPPORT
GameApp._resource = null;
#endif
#if ALICIZAX_SCENE_SUPPORT
GameApp._scene = null;
#endif
#if ALICIZAX_TIMER_SUPPORT
GameApp._timer = null;
#endif
#if ALICIZAX_UI_SUPPORT
GameApp._ui = null;
#endif
}
}
#endif