mirror of https://github.com/tuyoogame/YooAsset
perf : optimize asset bundle builder
parent
fbec06fa81
commit
e9b7336146
|
@ -56,6 +56,7 @@ namespace YooAsset.Editor
|
||||||
public string EncryptedFilePath { set; get; }
|
public string EncryptedFilePath { set; get; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private readonly HashSet<string> _assetPaths = new HashSet<string>(1000);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 参与构建的资源列表
|
/// 参与构建的资源列表
|
||||||
|
@ -84,9 +85,11 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void PackAsset(BuildAssetInfo buildAsset)
|
public void PackAsset(BuildAssetInfo buildAsset)
|
||||||
{
|
{
|
||||||
if (IsContainsAsset(buildAsset.AssetInfo.AssetPath))
|
string assetPath = buildAsset.AssetInfo.AssetPath;
|
||||||
throw new System.Exception($"Should never get here ! Asset is existed : {buildAsset.AssetInfo.AssetPath}");
|
if (_assetPaths.Contains(assetPath))
|
||||||
|
throw new System.Exception($"Should never get here ! Asset is existed : {assetPath}");
|
||||||
|
|
||||||
|
_assetPaths.Add(assetPath);
|
||||||
MainAssets.Add(buildAsset);
|
MainAssets.Add(buildAsset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,14 +98,7 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsContainsAsset(string assetPath)
|
public bool IsContainsAsset(string assetPath)
|
||||||
{
|
{
|
||||||
foreach (var buildAsset in MainAssets)
|
return _assetPaths.Contains(assetPath);
|
||||||
{
|
|
||||||
if (buildAsset.AssetInfo.AssetPath == assetPath)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue