mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-26 02:30:18 +00:00
fix #590
This commit is contained in:
@@ -60,7 +60,7 @@ namespace YooAsset
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 尝试卸载指定资源的资源包(包括依赖资源)
|
/// 尝试卸载指定资源的资源包(包括依赖资源)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void TryUnloadUnusedAsset(AssetInfo assetInfo)
|
public void TryUnloadUnusedAsset(AssetInfo assetInfo, int loopCount)
|
||||||
{
|
{
|
||||||
if (assetInfo.IsInvalid)
|
if (assetInfo.IsInvalid)
|
||||||
{
|
{
|
||||||
@@ -68,6 +68,10 @@ namespace YooAsset
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (loopCount > 0)
|
||||||
|
{
|
||||||
|
loopCount--;
|
||||||
|
|
||||||
// 卸载主资源包加载器
|
// 卸载主资源包加载器
|
||||||
string mainBundleName = _bundleQuery.GetMainBundleName(assetInfo);
|
string mainBundleName = _bundleQuery.GetMainBundleName(assetInfo);
|
||||||
var mainLoader = TryGetBundleFileLoader(mainBundleName);
|
var mainLoader = TryGetBundleFileLoader(mainBundleName);
|
||||||
@@ -98,6 +102,7 @@ namespace YooAsset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加载场景对象
|
/// 加载场景对象
|
||||||
|
|||||||
@@ -361,21 +361,21 @@ namespace YooAsset
|
|||||||
/// 资源回收
|
/// 资源回收
|
||||||
/// 说明:尝试卸载指定的资源
|
/// 说明:尝试卸载指定的资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void TryUnloadUnusedAsset(string location)
|
public void TryUnloadUnusedAsset(string location, int loopCount = 10)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
|
AssetInfo assetInfo = ConvertLocationToAssetInfo(location, null);
|
||||||
_resourceManager.TryUnloadUnusedAsset(assetInfo);
|
_resourceManager.TryUnloadUnusedAsset(assetInfo, loopCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 资源回收
|
/// 资源回收
|
||||||
/// 说明:尝试卸载指定的资源
|
/// 说明:尝试卸载指定的资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void TryUnloadUnusedAsset(AssetInfo assetInfo)
|
public void TryUnloadUnusedAsset(AssetInfo assetInfo, int loopCount = 10)
|
||||||
{
|
{
|
||||||
DebugCheckInitialize();
|
DebugCheckInitialize();
|
||||||
_resourceManager.TryUnloadUnusedAsset(assetInfo);
|
_resourceManager.TryUnloadUnusedAsset(assetInfo, loopCount);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user