diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs index eef86f7..df1486e 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneBattle.cs @@ -35,13 +35,13 @@ internal class FsmSceneBattle : IStateNode private IEnumerator Prepare() { - yield return UniWindow.OpenWindowAsync("UILoading"); yield return YooAssets.LoadSceneAsync("scene_battle"); _battleRoom = new BattleRoom(); yield return _battleRoom.LoadRoom(); - // 等所有数据准备完毕后,关闭加载界面。 - UniWindow.CloseWindow(); + // 释放资源 + var package = YooAssets.GetPackage("DefaultPackage"); + package.UnloadUnusedAssets(); } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs index a92d193..df6e8d9 100644 --- a/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs +++ b/Assets/YooAsset/Samples~/Space Shooter/GameScript/Runtime/GameLogic/FsmNode/FsmSceneHome.cs @@ -28,14 +28,11 @@ internal class FsmSceneHome : IStateNode private IEnumerator Prepare() { - if (_machine.PreviousNode != typeof(FsmInitGame).FullName) - yield return UniWindow.OpenWindowAsync("UILoading"); - yield return YooAssets.LoadSceneAsync("scene_home"); yield return UniWindow.OpenWindowAsync("UIHome"); - yield return new WaitForSeconds(0.5f); - - // 等所有数据准备完毕后,关闭加载界面。 - UniWindow.CloseWindow(); + + // 释放资源 + var package = YooAssets.GetPackage("DefaultPackage"); + package.UnloadUnusedAssets(); } } \ No newline at end of file