【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

@@ -175,36 +175,14 @@ namespace Stary.Evo
{
GameObject.Destroy(domainBase.gameObject);
await ForceUnloadAllAssets(domainBase.DomainName);
await ((FsmLoadSystem)FsmSystem).ForceUnloadAllAssets(domainBase.DomainName);
}
if (loadResType == DomainConfig.LoadResType.Scene)
{
await SceneManager.UnloadSceneAsync(_sceneName);
}
AppConfig.PackageDomainName = "";
}
}
// 强制卸载所有资源包,该方法请在合适的时机调用。
// 注意Package在销毁的时候也会自动调用该方法。
private 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} 资源包不存在,请检查是否已经卸载还是卸载异常...");
}
}
}