From c707cc1a38c421ee143adcd59be4bf0402af199a Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Wed, 8 May 2024 10:06:33 +0800 Subject: [PATCH] GameApp Shutdown --- UnityProject/Assets/GameScripts/HotFix/GameLogic/GameApp.cs | 2 ++ .../Assets/TEngine/Runtime/Core/Utility/Utility.Unity.cs | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/GameApp.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/GameApp.cs index 70d225da..f5707b3b 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/GameApp.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/GameApp.cs @@ -46,6 +46,7 @@ public partial class GameApp:Singleton /// 关闭游戏框架类型。 public static void Shutdown(ShutdownType shutdownType) { + Log.Info("GameApp Shutdown"); if (shutdownType == ShutdownType.None) { return; @@ -128,6 +129,7 @@ public partial class GameApp:Singleton var logic = listLogic[i]; logic.OnDestroy(); } + Shutdown(ShutdownType.Restart); } private void OnDrawGizmos() diff --git a/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Unity.cs b/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Unity.cs index e0045672..83427579 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Unity.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/Utility/Utility.Unity.cs @@ -266,7 +266,7 @@ namespace TEngine { if (_behaviour != null) { - _behaviour.Release(); + _behaviour.Shutdown(); } if (_entity != null) { @@ -392,8 +392,9 @@ namespace TEngine OnApplicationPauseEvent -= fun; } - public void Release() + internal void Shutdown() { + DestroyEvent?.Invoke(); UpdateEvent = null; FixedUpdateEvent = null; LateUpdateEvent = null;