mirror of https://github.com/tuyoogame/YooAsset
Compare commits
8 Commits
a618b6cf9e
...
697a87721f
Author | SHA1 | Date |
---|---|---|
|
697a87721f | |
|
09cf93d852 | |
|
8725821a27 | |
|
a2e57c6e90 | |
|
6d37bca2a9 | |
|
8471bb0f9a | |
|
05cb57db09 | |
|
064e9a1aa3 |
|
@ -2,6 +2,41 @@
|
|||
|
||||
All notable changes to this package will be documented in this file.
|
||||
|
||||
## [1.5.4-preview] - 2023-08-25
|
||||
|
||||
优化了资源清单文件构建速度(极大提升构建体验)(感谢yingnierxiao同学)。
|
||||
|
||||
### Fixed
|
||||
|
||||
- (#130) 修复了打包路径无效问题bug
|
||||
- (#138) 修复了Unity不支持的格式的原生文件会报warning
|
||||
|
||||
### Added
|
||||
|
||||
- 新增了IBuildinQueryServices 接口。
|
||||
|
||||
### Changed
|
||||
|
||||
- 在开启可寻址模式下,默认支持通过资源路径加载资源对象。
|
||||
|
||||
- 优化了资源收集界面,增加了配置相关的警示提示。
|
||||
|
||||
- 优化了资源报告界面,增加了BundleView界面里的builtin资源的列表显示。
|
||||
|
||||
- IQueryServices接口变更为IBuildinQueryServices接口
|
||||
|
||||
- EOperationStatus增加了正在处理的状态。
|
||||
|
||||
```c#
|
||||
public enum EOperationStatus
|
||||
{
|
||||
None,
|
||||
Processing,
|
||||
Succeed,
|
||||
Failed
|
||||
}
|
||||
```
|
||||
|
||||
## [1.5.3-preview] - 2023-07-28
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -40,7 +40,12 @@ namespace YooAsset.Editor
|
|||
manifest.OutputNameStyle = (int)buildParameters.OutputNameStyle;
|
||||
manifest.PackageName = buildParameters.PackageName;
|
||||
manifest.PackageVersion = buildParameters.PackageVersion;
|
||||
|
||||
// 填充资源包集合
|
||||
manifest.BundleList = GetAllPackageBundle(context);
|
||||
CacheBundleIDs(manifest);
|
||||
|
||||
// 填充主资源集合
|
||||
manifest.AssetList = GetAllPackageAsset(context, manifest);
|
||||
|
||||
// 更新Unity内置资源包的引用关系
|
||||
|
@ -147,7 +152,7 @@ namespace YooAsset.Editor
|
|||
packageAsset.AssetPath = assetInfo.AssetPath;
|
||||
packageAsset.AssetGUID = buildMapContext.Command.IncludeAssetGUID ? assetInfo.AssetGUID : string.Empty;
|
||||
packageAsset.AssetTags = assetInfo.AssetTags.ToArray();
|
||||
packageAsset.BundleID = GetAssetBundleID(assetInfo.BundleName, manifest);
|
||||
packageAsset.BundleID = GetCachedBundleID(assetInfo.BundleName);
|
||||
packageAsset.DependIDs = GetAssetBundleDependIDs(packageAsset.BundleID, assetInfo, manifest);
|
||||
result.Add(packageAsset);
|
||||
}
|
||||
|
@ -156,12 +161,12 @@ namespace YooAsset.Editor
|
|||
}
|
||||
private int[] GetAssetBundleDependIDs(int mainBundleID, BuildAssetInfo assetInfo, PackageManifest manifest)
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
HashSet<int> result = new HashSet<int>();
|
||||
foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos)
|
||||
{
|
||||
if (dependAssetInfo.HasBundleName())
|
||||
{
|
||||
int bundleID = GetAssetBundleID(dependAssetInfo.BundleName, manifest);
|
||||
int bundleID = GetCachedBundleID(dependAssetInfo.BundleName);
|
||||
if (mainBundleID != bundleID)
|
||||
{
|
||||
if (result.Contains(bundleID) == false)
|
||||
|
@ -171,15 +176,6 @@ namespace YooAsset.Editor
|
|||
}
|
||||
return result.ToArray();
|
||||
}
|
||||
private int GetAssetBundleID(string bundleName, PackageManifest manifest)
|
||||
{
|
||||
for (int index = 0; index < manifest.BundleList.Count; index++)
|
||||
{
|
||||
if (manifest.BundleList[index].BundleName == bundleName)
|
||||
return index;
|
||||
}
|
||||
throw new Exception($"Not found bundle name : {bundleName}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新Unity内置资源包的引用关系
|
||||
|
@ -212,7 +208,7 @@ namespace YooAsset.Editor
|
|||
List<string> conflictAssetPathList = dependBundles.Intersect(shaderBundleReferenceList).ToList();
|
||||
if (conflictAssetPathList.Count > 0)
|
||||
{
|
||||
List<int> newDependIDs = new List<int>(packageAsset.DependIDs);
|
||||
HashSet<int> newDependIDs = new HashSet<int>(packageAsset.DependIDs);
|
||||
if (newDependIDs.Contains(shaderBundleId) == false)
|
||||
newDependIDs.Add(shaderBundleId);
|
||||
packageAsset.DependIDs = newDependIDs.ToArray();
|
||||
|
@ -226,7 +222,7 @@ namespace YooAsset.Editor
|
|||
|
||||
// 更新资源包标签
|
||||
var packageBundle = manifest.BundleList[shaderBundleId];
|
||||
List<string> newTags = new List<string>(packageBundle.Tags);
|
||||
HashSet<string> newTags = new HashSet<string>(packageBundle.Tags);
|
||||
foreach (var tag in tagTemps)
|
||||
{
|
||||
if (newTags.Contains(tag) == false)
|
||||
|
@ -250,23 +246,22 @@ namespace YooAsset.Editor
|
|||
#region 资源包引用关系相关
|
||||
private readonly Dictionary<string, int> _cachedBundleID = new Dictionary<string, int>(10000);
|
||||
private readonly Dictionary<string, string[]> _cachedBundleDepends = new Dictionary<string, string[]>(10000);
|
||||
|
||||
private void CacheBundleIDs(PackageManifest manifest)
|
||||
{
|
||||
UnityEngine.Debug.Assert(manifest.BundleList.Count != 0, "Manifest bundle list is empty !");
|
||||
for (int index = 0; index < manifest.BundleList.Count; index++)
|
||||
{
|
||||
string bundleName = manifest.BundleList[index].BundleName;
|
||||
_cachedBundleID.Add(bundleName, index);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateScriptPipelineReference(PackageManifest manifest, TaskBuilding_SBP.BuildResultContext buildResultContext)
|
||||
{
|
||||
int progressValue;
|
||||
int totalCount = manifest.BundleList.Count;
|
||||
|
||||
// 缓存资源包ID
|
||||
_cachedBundleID.Clear();
|
||||
progressValue = 0;
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
int bundleID = GetAssetBundleID(packageBundle.BundleName, manifest);
|
||||
_cachedBundleID.Add(packageBundle.BundleName, bundleID);
|
||||
EditorTools.DisplayProgressBar("缓存资源包索引", ++progressValue, totalCount);
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
|
||||
// 缓存资源包依赖
|
||||
_cachedBundleDepends.Clear();
|
||||
progressValue = 0;
|
||||
|
@ -283,7 +278,11 @@ namespace YooAsset.Editor
|
|||
|
||||
var depends = buildResultContext.Results.BundleInfos[packageBundle.BundleName].Dependencies;
|
||||
_cachedBundleDepends.Add(packageBundle.BundleName, depends);
|
||||
EditorTools.DisplayProgressBar("缓存资源包依赖列表", ++progressValue, totalCount);
|
||||
int pro = ++progressValue;
|
||||
if (pro % 100 == 0)
|
||||
{
|
||||
EditorTools.DisplayProgressBar("缓存资源包依赖列表", pro, totalCount);
|
||||
}
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
|
||||
|
@ -291,7 +290,11 @@ namespace YooAsset.Editor
|
|||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
packageBundle.ReferenceIDs = GetBundleRefrenceIDs(manifest, packageBundle);
|
||||
EditorTools.DisplayProgressBar("计算资源包引用关系", ++progressValue, totalCount);
|
||||
int pro = ++progressValue;
|
||||
if (pro % 100 == 0)
|
||||
{
|
||||
EditorTools.DisplayProgressBar("计算资源包引用关系", pro, totalCount);
|
||||
}
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
}
|
||||
|
@ -300,17 +303,6 @@ namespace YooAsset.Editor
|
|||
int progressValue;
|
||||
int totalCount = manifest.BundleList.Count;
|
||||
|
||||
// 缓存资源包ID
|
||||
_cachedBundleID.Clear();
|
||||
progressValue = 0;
|
||||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
int bundleID = GetAssetBundleID(packageBundle.BundleName, manifest);
|
||||
_cachedBundleID.Add(packageBundle.BundleName, bundleID);
|
||||
EditorTools.DisplayProgressBar("缓存资源包索引", ++progressValue, totalCount);
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
|
||||
// 缓存资源包依赖
|
||||
_cachedBundleDepends.Clear();
|
||||
progressValue = 0;
|
||||
|
@ -324,7 +316,11 @@ namespace YooAsset.Editor
|
|||
|
||||
var depends = buildResultContext.UnityManifest.GetDirectDependencies(packageBundle.BundleName);
|
||||
_cachedBundleDepends.Add(packageBundle.BundleName, depends);
|
||||
EditorTools.DisplayProgressBar("缓存资源包依赖列表", ++progressValue, totalCount);
|
||||
int pro = ++progressValue;
|
||||
if (pro % 100 == 0)
|
||||
{
|
||||
EditorTools.DisplayProgressBar("缓存资源包依赖列表", pro, totalCount);
|
||||
}
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
|
||||
|
@ -333,7 +329,11 @@ namespace YooAsset.Editor
|
|||
foreach (var packageBundle in manifest.BundleList)
|
||||
{
|
||||
packageBundle.ReferenceIDs = GetBundleRefrenceIDs(manifest, packageBundle);
|
||||
EditorTools.DisplayProgressBar("计算资源包引用关系", ++progressValue, totalCount);
|
||||
int pro = ++progressValue;
|
||||
if (pro % 100 == 0)
|
||||
{
|
||||
EditorTools.DisplayProgressBar("计算资源包引用关系", ++progressValue, totalCount);
|
||||
}
|
||||
}
|
||||
EditorTools.ClearProgressBar();
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
}
|
||||
|
||||
List<int> result = new List<int>();
|
||||
HashSet<int> result = new HashSet<int>();
|
||||
foreach (var bundleName in referenceList)
|
||||
{
|
||||
int bundleID = GetCachedBundleID(bundleName);
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace YooAsset.Editor
|
|||
guids = AssetDatabase.FindAssets($"t:{searchType}", searchInFolders);
|
||||
|
||||
// 注意:AssetDatabase.FindAssets()可能会获取到重复的资源
|
||||
List<string> result = new List<string>();
|
||||
HashSet<string> result = new HashSet<string>();
|
||||
for (int i = 0; i < guids.Length; i++)
|
||||
{
|
||||
string guid = guids[i];
|
||||
|
|
|
@ -51,6 +51,9 @@ namespace YooAsset
|
|||
// 准备下载
|
||||
if (_steps == ESteps.PrepareDownload)
|
||||
{
|
||||
// 获取请求地址
|
||||
_requestURL = GetRequestURL();
|
||||
|
||||
// 重置变量
|
||||
_downloadProgress = 0f;
|
||||
_downloadedBytes = 0;
|
||||
|
@ -59,14 +62,16 @@ namespace YooAsset
|
|||
_isAbort = false;
|
||||
_latestDownloadBytes = 0;
|
||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
||||
|
||||
// 重置计时器
|
||||
if(_tryAgainTimer > 0f)
|
||||
YooLogger.Warning($"Try again download : {_requestURL}");
|
||||
_tryAgainTimer = 0f;
|
||||
|
||||
// 删除临时文件
|
||||
if (File.Exists(_tempFilePath))
|
||||
File.Delete(_tempFilePath);
|
||||
|
||||
// 获取请求地址
|
||||
_requestURL = GetRequestURL();
|
||||
_steps = ESteps.CreateDownloader;
|
||||
}
|
||||
|
||||
|
@ -197,7 +202,6 @@ namespace YooAsset
|
|||
_failedTryAgain--;
|
||||
_steps = ESteps.PrepareDownload;
|
||||
ReportWarning();
|
||||
YooLogger.Warning($"Try again download : {_requestURL}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,9 @@ namespace YooAsset
|
|||
// 创建下载器
|
||||
if (_steps == ESteps.PrepareDownload)
|
||||
{
|
||||
// 获取请求地址
|
||||
_requestURL = GetRequestURL();
|
||||
|
||||
// 重置变量
|
||||
_downloadProgress = 0f;
|
||||
_downloadedBytes = 0;
|
||||
|
@ -99,11 +102,13 @@ namespace YooAsset
|
|||
_isAbort = false;
|
||||
_latestDownloadBytes = 0;
|
||||
_latestDownloadRealtime = Time.realtimeSinceStartup;
|
||||
_tryAgainTimer = 0f;
|
||||
_fileOriginLength = 0;
|
||||
|
||||
// 获取请求地址
|
||||
_requestURL = GetRequestURL();
|
||||
// 重置计时器
|
||||
if (_tryAgainTimer > 0f)
|
||||
YooLogger.Warning($"Try again download : {_requestURL}");
|
||||
_tryAgainTimer = 0f;
|
||||
|
||||
_steps = ESteps.CreateDownloader;
|
||||
}
|
||||
|
||||
|
@ -257,7 +262,6 @@ namespace YooAsset
|
|||
_failedTryAgain--;
|
||||
_steps = ESteps.PrepareDownload;
|
||||
ReportWarning();
|
||||
YooLogger.Warning($"Try again download : {_requestURL}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,14 +74,14 @@ namespace YooAsset
|
|||
internal abstract void Start();
|
||||
internal abstract void Update();
|
||||
|
||||
internal void OnFinish()
|
||||
internal void SetFinish()
|
||||
{
|
||||
Progress = 1f;
|
||||
_callback?.Invoke(this);
|
||||
if (_taskCompletionSource != null)
|
||||
_taskCompletionSource.TrySetResult(null);
|
||||
}
|
||||
internal void OnStart()
|
||||
internal void SetStart()
|
||||
{
|
||||
Status = EOperationStatus.Processing;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace YooAsset
|
|||
if (operation.IsDone)
|
||||
{
|
||||
_removeList.Add(operation);
|
||||
operation.OnFinish();
|
||||
operation.SetFinish();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace YooAsset
|
|||
public static void StartOperation(AsyncOperationBase operation)
|
||||
{
|
||||
_addList.Add(operation);
|
||||
operation.OnStart();
|
||||
operation.SetStart();
|
||||
operation.Start();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -208,6 +208,10 @@ namespace YooAsset
|
|||
packageBundle.ParseBundle(Manifest.PackageName, Manifest.OutputNameStyle);
|
||||
Manifest.BundleDic.Add(packageBundle.BundleName, packageBundle);
|
||||
|
||||
// 注意:原始文件可能存在相同的CacheGUID
|
||||
if (Manifest.CacheGUIDs.Contains(packageBundle.CacheGUID) == false)
|
||||
Manifest.CacheGUIDs.Add(packageBundle.CacheGUID);
|
||||
|
||||
_packageBundleCount--;
|
||||
Progress = 1f - _packageBundleCount / _progressTotalValue;
|
||||
if (OperationSystem.IsBusy)
|
||||
|
|
|
@ -82,6 +82,12 @@ namespace YooAsset
|
|||
[NonSerialized]
|
||||
public Dictionary<string, string> AssetPathMapping2;
|
||||
|
||||
/// <summary>
|
||||
/// 该资源清单所有文件的缓存GUID集合
|
||||
/// </summary>
|
||||
[NonSerialized]
|
||||
public HashSet<string> CacheGUIDs = new HashSet<string>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 尝试映射为资源路径
|
||||
|
@ -191,12 +197,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public bool IsIncludeBundleFile(string cacheGUID)
|
||||
{
|
||||
foreach (var packageBundle in BundleList)
|
||||
{
|
||||
if (packageBundle.CacheGUID == cacheGUID)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return CacheGUIDs.Contains(cacheGUID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "YooAsset",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "com.tuyoogame.yooasset",
|
||||
"displayName": "YooAsset",
|
||||
"version": "1.5.3-preview",
|
||||
"version": "1.5.4-preview",
|
||||
"unity": "2019.4",
|
||||
"description": "unity3d resources management system.",
|
||||
"author": {
|
||||
|
|
Loading…
Reference in New Issue