com.alicizax.unity.entry/Runtime/GameAppStaticMemberReset.cs

38 lines
897 B
C#
Raw Normal View History

2025-04-02 19:28:28 +08:00
#if UNITY_EDITOR
using System.Reflection;
using AlicizaX.EventKit;
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;
GameApp._audio = null;
GameApp._event = null;
GameApp._fsm = null;
GameApp._localization = null;
2025-07-14 17:03:29 +08:00
#if ALICIZAX_NETWORK
2025-04-02 19:28:28 +08:00
GameApp._network = null;
2025-07-14 17:03:29 +08:00
#endif
2025-04-02 19:28:28 +08:00
GameApp._objectPool = null;
GameApp._resource = null;
GameApp._scene = null;
GameApp._timer = null;
GameApp._ui = null;
}
}
#endif