【m】框架大更新

This commit is contained in:
2025-10-31 11:18:23 +08:00
parent ae6e7c804b
commit 8e1d52ddbf
1883 changed files with 213934 additions and 640 deletions

View File

@@ -1,5 +1,8 @@
using Main;
using System;
using Cysharp.Threading.Tasks;
using Main;
using UnityEngine;
using YooAsset;
namespace Stary.Evo
{
@@ -31,5 +34,28 @@ namespace Stary.Evo
{
return this.transformCtor;
}
// 强制卸载所有资源包,该方法请在合适的时机调用。
// 注意Package在销毁的时候也会自动调用该方法。
public async UniTask ForceUnloadAllAssets(string packageName)
{
var package = YooAssets.TryGetPackage(packageName);
if (package != null)
{
var operation = package.UnloadAllAssetsAsync();
await operation;
await package.DestroyAsync();
YooAssets.RemovePackage(packageName);
Resources.UnloadUnusedAssets();
GC.Collect();
GC.WaitForPendingFinalizers();
Debug.Log($"UnityEvo:{packageName} 资源包已卸载...");
}
else
{
Debug.LogWarning($"UnityEvo:{packageName} 资源包不存在,请检查是否已经卸载还是卸载异常...");
}
}
}
}