Compare commits

...

33 Commits

Author SHA1 Message Date
邬春鹏
ae087453d9 优化代码结构 2025-06-09 16:06:12 +08:00
邬春鹏
31c79f3f84 调整search模式的判定方式 2025-06-07 10:02:02 +08:00
邬春鹏
4293d70f85 提示方式改成统一用border 2025-06-06 12:57:16 +08:00
邬春鹏
6f5bc1b628 显示筛选过后的collector 2025-06-05 12:31:57 +08:00
邬春鹏
453cb26500 用border提示某些选项的匹配 2025-06-05 11:58:43 +08:00
邬春鹏
f35248c119 颜色提示优化 2025-06-05 11:49:22 +08:00
邬春鹏
830eb7c460 只显示筛选过的条目 2025-06-05 11:07:19 +08:00
邬春鹏
ce4a00ef7c 搜索文字颜色 2025-06-05 10:38:12 +08:00
邬春鹏
986a31cae2 group文字颜色 2025-06-05 09:35:18 +08:00
邬春鹏
1aecb54964 搜索文字颜色 2025-06-05 09:22:13 +08:00
邬春鹏
33ac8556ce 完善搜索逻辑 2025-06-04 18:31:44 +08:00
邬春鹏
517f133b21 提示信息和搜索时屏蔽操作按钮 2025-06-04 17:55:08 +08:00
邬春鹏
517830dbef 增加搜索框 2025-06-04 16:38:42 +08:00
何冠峰
4f62b249b4 update TableView
增加AssetObjectCell类
2025-05-19 16:25:16 +08:00
何冠峰
fe7f9bff08 fix #552 2025-05-15 15:38:13 +08:00
何冠峰
e71077f294 fix space shooter quit game error
修复太空战机DEMO在退出运行模式时的报错。
2025-05-13 17:53:17 +08:00
何冠峰
eabebf3d8f Update CHANGELOG.md 2025-05-13 10:47:59 +08:00
何冠峰
4ef789520a Update package.json 2025-05-13 10:47:49 +08:00
何冠峰
4322f3c58c fix #545 2025-05-13 10:23:22 +08:00
何冠峰
c40a796170 fix #542 2025-05-13 10:11:06 +08:00
何冠峰
32841d4773 Update AssetBundleDebuggerWindow.cs 2025-05-09 15:29:26 +08:00
何冠峰
e469b32d94 refactor: The tag diffusion logic in the collector
优化收集器tag传染扩散逻辑,避免Group里配置了Tag导致的无意义的警告信息。
2025-04-23 18:42:26 +08:00
何冠峰
c0e5315953 feat : Buld the pipeline output the log file.
构建管线输出构建日志到输出目录下。
2025-04-23 18:19:13 +08:00
何冠峰
7b5f366533 Build system add BuiltinShadersBundleNameIsNull ErrorCode 2025-04-23 16:56:03 +08:00
何冠峰
e674d5bf97 update extension sample
PanelMonitor增加控制开关
2025-04-23 16:39:07 +08:00
何冠峰
9b0bebd981 refactor : Macro scripts control by YOO_ASSET_EXPERIMENT 2025-04-23 16:38:17 +08:00
何冠峰
dc46462bfa fix : remove Caching class
it's not support in webGL
2025-04-23 14:14:34 +08:00
何冠峰
51c9943cf2 修复了输出csproject工程文件编码为UTF16的问题
修正BOM问题
2025-04-22 17:41:36 +08:00
何冠峰
3db9b750e3 update logo 2025-04-22 16:47:44 +08:00
何冠峰
1b57a0b7df 修复了输出csproject工程文件编码为UTF16的问题。 2025-04-22 16:47:33 +08:00
何冠峰
bd5ce1e6bd perf : webgl platform use crc verify the bundle when first time downloaded
WebGL平台首次下载会验证CRC。
2025-04-18 18:21:24 +08:00
何冠峰
7eb74d4dd1 update extension sample 2025-04-18 17:11:40 +08:00
何冠峰
a384ca1f18 feat : scriptable build pipeline add StripUnityVersion parameter.
新增构建参数
2025-04-18 16:48:03 +08:00
29 changed files with 610 additions and 62 deletions

View File

@@ -2,6 +2,46 @@
All notable changes to this package will be documented in this file.
## [2.3.9] - 2025-05-13
### Improvements
- 增加了YOO_ASSET_EXPERIMENT宏用于控制实验性代码的开关。
- 构建管线目前会输出构建日志到输出目录下,方便查看引擎在构建时主动清空的控制台日志。
- 优化了收集器tag传染扩散逻辑避免Group里配置了Tag导致的无意义的警告信息。
- 扩展工程内PanelMonitor代码默认关闭状态。
### Fixed
- (#528) 修复了AssetDependencyDatabase在查询引擎资源对象是否存在的时效问题。
### Added
- (#542) 新增了资源管理系统销毁方法。
该方法会销毁所有的资源包裹和异步操作任务以及卸载所有AssetBundle对象
```csharp
public class YooAssets
{
/// <summary>
/// 销毁资源系统
/// </summary>
public static void Destroy();
}
```
- 新增了SBP构建管线的构建参数
```csharp
/// <summary>
/// 从AssetBundle文件头里剥离Unity版本信息
/// </summary>
public bool StripUnityVersion = false;
```
- 新增了构建错误码BuiltinShadersBundleNameIsNull
## [2.3.8] - 2025-04-17
### Improvements

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
#if YOO_ASSET_EXPERIMENT
namespace YooAsset.Editor
{
public class MacroDefine
@@ -15,3 +16,4 @@ namespace YooAsset.Editor
};
}
}
#endif

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Xml;
using UnityEditor;
#if YOO_ASSET_EXPERIMENT
namespace YooAsset.Editor
{
[InitializeOnLoad]
@@ -22,13 +23,21 @@ namespace YooAsset.Editor
return content;
// 将修改后的XML结构重新输出为文本
var stringWriter = new StringWriter();
var writerSettings = new XmlWriterSettings();
writerSettings.Indent = true;
var xmlWriter = XmlWriter.Create(stringWriter, writerSettings);
xmlDoc.WriteTo(xmlWriter);
xmlWriter.Flush();
return stringWriter.ToString();
using (var memoryStream = new MemoryStream())
{
var writerSettings = new XmlWriterSettings
{
Indent = true,
Encoding = new UTF8Encoding(false), //无BOM
OmitXmlDeclaration = false
};
using (var xmlWriter = XmlWriter.Create(memoryStream, writerSettings))
{
xmlDoc.Save(xmlWriter);
}
return Encoding.UTF8.GetString(memoryStream.ToArray());
}
}
/// <summary>
@@ -94,3 +103,4 @@ namespace YooAsset.Editor
}
}
}
#endif

View File

@@ -196,6 +196,32 @@ namespace YooAsset.Editor
}
}
/// <summary>
/// 导入单个报告对象
/// </summary>
public void ImportSingleReprotFile(ScanReport report)
{
_reportCombiner = new ScanReportCombiner();
try
{
_reportCombiner.Combine(report);
// 刷新页面
RefreshToolbar();
FillTableView();
RebuildView();
}
catch (System.Exception e)
{
_reportCombiner = null;
_titleLabel.text = "导入报告失败!";
_descLabel.text = e.Message;
UnityEngine.Debug.LogError(e.StackTrace);
}
}
private void ImportSingleBtn_clicked()
{
string selectFilePath = EditorUtility.OpenFilePanel("导入报告", _lastestOpenFolder, "json");
@@ -446,15 +472,31 @@ namespace YooAsset.Editor
var column = new TableColumn(header.HeaderTitle, header.HeaderTitle, columnStyle);
column.MakeCell = () =>
{
var label = new Label();
label.style.marginLeft = 3f;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
return label;
if (header.HeaderType == EHeaderType.AssetObject)
{
var objectFiled = new ObjectField();
return objectFiled;
}
else
{
var label = new Label();
label.style.marginLeft = 3f;
label.style.unityTextAlign = TextAnchor.MiddleLeft;
return label;
}
};
column.BindCell = (VisualElement element, ITableData data, ITableCell cell) =>
{
var infoLabel = element as Label;
infoLabel.text = (string)cell.GetDisplayObject();
if (header.HeaderType == EHeaderType.AssetObject)
{
var objectFiled = element as ObjectField;
objectFiled.value = (UnityEngine.Object)cell.GetDisplayObject();
}
else
{
var infoLabel = element as Label;
infoLabel.text = (string)cell.GetDisplayObject();
}
};
_elementTableView.AddColumn(column);
}
@@ -480,6 +522,10 @@ namespace YooAsset.Editor
{
tableData.AddAssetPathCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);
}
else if (header.HeaderType == EHeaderType.AssetObject)
{
tableData.AddAssetObjectCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);
}
else if (header.HeaderType == EHeaderType.StringValue)
{
tableData.AddStringValueCell(scanInfo.HeaderTitle, scanInfo.ScanInfo);

View File

@@ -8,6 +8,11 @@ namespace YooAsset.Editor
/// </summary>
AssetPath,
/// <summary>
/// 资源对象
/// </summary>
AssetObject,
/// <summary>
/// 字符串
/// </summary>

View File

@@ -126,6 +126,12 @@ namespace YooAsset.Editor
if (string.IsNullOrEmpty(guid))
throw new Exception($"{HeaderTitle} value is invalid asset path : {value}");
}
else if (HeaderType == EHeaderType.AssetObject)
{
string guid = AssetDatabase.AssetPathToGUID(value);
if (string.IsNullOrEmpty(guid))
throw new Exception($"{HeaderTitle} value is invalid asset object : {value}");
}
else if (HeaderType == EHeaderType.DoubleValue)
{
if (double.TryParse(value, out double doubleValue) == false)

View File

@@ -46,7 +46,7 @@ namespace YooAsset.Editor
}
catch (Exception e)
{
return new ScannerResult(e.Message);
return new ScannerResult(e.StackTrace);
}
}

View File

@@ -52,7 +52,7 @@ namespace YooAsset.Editor
if (Succeed)
{
var reproterWindow = AssetArtReporterWindow.OpenWindow();
reproterWindow.ImportSingleReprotFile(ReprotFilePath);
reproterWindow.ImportSingleReprotFile(Report);
}
}
}

View File

@@ -32,8 +32,9 @@ namespace YooAsset.Editor
var buildParametersContext = new BuildParametersContext(buildParameters);
_buildContext.SetContextObject(buildParametersContext);
// 初始化日志
BuildLogger.InitLogger(enableLog);
// 初始化日志系统
string logFilePath = $"{buildParametersContext.GetPipelineOutputDirectory()}/buildInfo.log";
BuildLogger.InitLogger(enableLog, logFilePath);
// 执行构建流程
BuildLogger.Log($"Begin to build package : {buildParameters.PackageName} by {buildParameters.BuildPipeline}");
@@ -50,6 +51,9 @@ namespace YooAsset.Editor
BuildLogger.Error(buildResult.ErrorInfo);
}
// 关闭日志系统
BuildLogger.Shuntdown();
return buildResult;
}
}

View File

@@ -11,7 +11,7 @@ namespace YooAsset.Editor
void IBuildTask.Run(BuildContext context)
{
var buildParametersContext = context.GetContextObject<BuildParametersContext>();
var buildParameters = buildParametersContext.Parameters;
var buildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
// 检测基础构建参数
buildParametersContext.CheckBuildParameters();
@@ -50,6 +50,13 @@ namespace YooAsset.Editor
{
BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
}
// 检测内置着色器资源包名称
if (string.IsNullOrEmpty(buildParameters.BuiltinShadersBundleName))
{
string warning = BuildLogger.GetErrorMessage(ErrorCode.BuiltinShadersBundleNameIsNull, $"Builtin shaders bundle name is null. It will cause resource redundancy !");
BuildLogger.Warning(warning);
}
}
}
}

View File

@@ -14,6 +14,11 @@ namespace YooAsset.Editor
/// </summary>
public ECompressOption CompressOption = ECompressOption.Uncompressed;
/// <summary>
/// 从AssetBundle文件头里剥离Unity版本信息
/// </summary>
public bool StripUnityVersion = false;
/// <summary>
/// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
/// </summary>
@@ -70,6 +75,9 @@ namespace YooAsset.Editor
else
throw new System.NotImplementedException(CompressOption.ToString());
if (StripUnityVersion)
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.StripUnityVersion;
if (DisableWriteTypeTree)
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.DisableWriteTypeTree;

View File

@@ -2,37 +2,100 @@
using System.IO;
using System.Collections.Generic;
using UnityEngine;
using System.Text;
namespace YooAsset.Editor
{
internal static class BuildLogger
{
private static bool _enableLog = true;
private const int MAX_LOG_BUFFER_SIZE = 1024 * 1024 * 2; //2MB
public static void InitLogger(bool enableLog)
private static bool _enableLog = true;
private static string _logFilePath;
private static readonly object _lockObj = new object();
private static readonly StringBuilder _logBuilder = new StringBuilder(MAX_LOG_BUFFER_SIZE);
/// <summary>
/// 初始化日志系统
/// </summary>
public static void InitLogger(bool enableLog, string logFilePath)
{
_enableLog = enableLog;
_logFilePath = logFilePath;
_logBuilder.Clear();
if (_enableLog)
{
if (string.IsNullOrEmpty(_logFilePath))
throw new Exception("Log file path is null or empty !");
Debug.Log($"Logger initialized at {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
}
}
/// <summary>
/// 关闭日志系统
/// </summary>
public static void Shuntdown()
{
if (_enableLog)
{
lock (_lockObj)
{
try
{
if (File.Exists(_logFilePath))
File.Delete(_logFilePath);
FileUtility.CreateFileDirectory(_logFilePath);
File.WriteAllText(_logFilePath, _logBuilder.ToString(), Encoding.UTF8);
_logBuilder.Clear();
}
catch (Exception ex)
{
Debug.LogError($"Failed to write log file: {ex.Message}");
}
}
}
}
public static void Log(string message)
{
if (_enableLog)
{
WriteLog("INFO", message);
Debug.Log(message);
}
}
public static void Warning(string message)
{
Debug.LogWarning(message);
if (_enableLog)
{
WriteLog("WARN", message);
Debug.LogWarning(message);
}
}
public static void Error(string message)
{
Debug.LogError(message);
if (_enableLog)
{
WriteLog("ERROR", message);
Debug.LogError(message);
}
}
public static string GetErrorMessage(ErrorCode code, string message)
{
return $"[ErrorCode{(int)code}] {message}";
}
private static void WriteLog(string level, string message)
{
lock (_lockObj)
{
string logEntry = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} [{level}] {message}";
_logBuilder.AppendLine(logEntry);
}
}
}
}

View File

@@ -15,6 +15,7 @@ namespace YooAsset.Editor
BuildPipelineIsNullOrEmpty = 116,
BuildBundleTypeIsUnknown = 117,
RecommendScriptBuildPipeline = 130,
BuiltinShadersBundleNameIsNull = 131,
// TaskGetBuildMap
RemoveInvalidTags = 200,

View File

@@ -259,10 +259,13 @@ namespace YooAsset.Editor
}
private List<string> GetAssetTags(AssetBundleCollectorGroup group)
{
List<string> tags = EditorTools.StringToStringList(group.AssetTags, ';');
List<string> temper = EditorTools.StringToStringList(AssetTags, ';');
tags.AddRange(temper);
return tags;
List<string> result = EditorTools.StringToStringList(AssetTags, ';');
if (CollectorType == ECollectorType.MainAssetCollector)
{
List<string> temps = EditorTools.StringToStringList(group.AssetTags, ';');
result.AddRange(temps);
}
return result;
}
private List<AssetInfo> GetAllDependencies(CollectCommand command, string mainAssetPath)
{

View File

@@ -14,10 +14,15 @@ namespace YooAsset.Editor
[MenuItem("YooAsset/AssetBundle Collector", false, 101)]
public static void OpenWindow()
{
AssetBundleCollectorWindow window = GetWindow<AssetBundleCollectorWindow>("AssetBundle Collector", true, WindowsDefine.DockedWindowTypes);
AssetBundleCollectorWindow window =
GetWindow<AssetBundleCollectorWindow>("AssetBundle Collector", true, WindowsDefine.DockedWindowTypes);
window.minSize = new Vector2(800, 600);
}
private string _lowerSearchKey = string.Empty;
private ToolbarSearchField _searchField;
private Button _saveButton;
private List<string> _collectorTypeList;
private List<RuleDisplayName> _activeRuleList;
@@ -62,8 +67,7 @@ namespace YooAsset.Editor
private int _lastModifyGroupIndex = 0;
private bool _showGlobalSettings = false;
private bool _showPackageSettings = false;
public void CreateGUI()
{
try
@@ -89,6 +93,9 @@ namespace YooAsset.Editor
visualAsset.CloneTree(root);
_searchField = root.Q<ToolbarSearchField>("SearchField");
_searchField.RegisterValueChangedCallback(OnSearchFieldValueChanged);
// 警示栏
_helpBoxContainer = root.Q("HelpBoxContainer");
@@ -358,6 +365,14 @@ namespace YooAsset.Editor
Debug.LogError(e.ToString());
}
}
private void OnSearchFieldValueChanged(ChangeEvent<string> evt)
{
_lowerSearchKey = evt.newValue.ToLower();
RefreshWindow();
}
public void OnEnable()
{
Undo.undoRedoPerformed += RefreshWindow;
@@ -400,6 +415,7 @@ namespace YooAsset.Editor
FillPackageViewData();
RefreshSettings();
}
private void FixBtn_clicked()
{
AssetBundleCollectorSettingData.FixFile();
@@ -450,6 +466,18 @@ namespace YooAsset.Editor
else
return ruleDisplayName.ClassName;
}
private void ShowSearchBorder(VisualElement element)
{
element.style.borderBottomColor = new Color(0.7f,0,0,1);
element.style.borderBottomWidth = 1;
}
private void ClearBorder(VisualElement element)
{
element.style.borderBottomColor = Color.white;
element.style.borderBottomWidth = 0;
}
// 设置栏相关
private void RefreshSettings()
@@ -516,6 +544,13 @@ namespace YooAsset.Editor
#if UNITY_2020_3_OR_NEWER
_helpBoxContainer.Clear();
if (string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
string tips = "Currently in search mode";
var helpBox = new HelpBox(tips, HelpBoxMessageType.Error);
_helpBoxContainer.Add(helpBox);
}
if (_enableAddressableToogle.value && _locationToLowerToogle.value)
{
string tips = "The [Enable Addressable] option and [Location To Lower] option cannot be enabled at the same time.";
@@ -542,7 +577,69 @@ namespace YooAsset.Editor
{
_packageListView.Clear();
_packageListView.ClearSelection();
_packageListView.itemsSource = AssetBundleCollectorSettingData.Setting.Packages;
List<AssetBundleCollectorPackage> packages = null;
if (string.IsNullOrWhiteSpace(_lowerSearchKey))
{
packages = AssetBundleCollectorSettingData.Setting.Packages;
}
else
{
packages = new List<AssetBundleCollectorPackage>();
foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
{
//检查packageName
if (package.PackageName.ToLower().Contains(_lowerSearchKey))
{
packages.Add(package);
continue;
}
//检查Groups和GroupAssetTags
foreach (var group in package.Groups)
{
if (group.GroupName.ToLower().Contains(_lowerSearchKey))
{
packages.Add(package);
break;
}
if (group.AssetTags.ToLower().Contains(_lowerSearchKey))
{
packages.Add(package);
break;
}
var needAdd = false;
//检查Collectors和tags
foreach (var collector in group.Collectors)
{
if (collector.CollectPath.ToLower().Contains(_lowerSearchKey))
{
needAdd = true;
break;
}
if (collector.AssetTags.ToLower().Contains(_lowerSearchKey))
{
needAdd = true;
break;
}
}
if (needAdd)
{
packages.Add(package);
break;
}
}
}
}
_packageListView.itemsSource = packages;
_packageListView.Rebuild();
if (_lastModifyPackageIndex >= 0 && _lastModifyPackageIndex < _packageListView.itemsSource.Count)
@@ -550,6 +647,7 @@ namespace YooAsset.Editor
_packageListView.selectedIndex = _lastModifyPackageIndex;
}
}
private VisualElement MakePackageListViewItem()
{
VisualElement element = new VisualElement();
@@ -567,13 +665,26 @@ namespace YooAsset.Editor
}
private void BindPackageListViewItem(VisualElement element, int index)
{
var package = AssetBundleCollectorSettingData.Setting.Packages[index];
var package = _packageListView.itemsSource[index] as AssetBundleCollectorPackage;
var textField1 = element.Q<Label>("Label1");
if (string.IsNullOrEmpty(package.PackageDesc))
textField1.text = package.PackageName;
else
textField1.text = $"{package.PackageName} ({package.PackageDesc})";
textField1.text = package.PackageName;
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
if(package.PackageName.ToLower().Contains(_lowerSearchKey))
{
ShowSearchBorder(element);
}
else
{
ClearBorder(element);
}
}
else
{
ClearBorder(element);
}
}
private void PackageListView_onSelectionChange(IEnumerable<object> objs)
{
@@ -620,9 +731,48 @@ namespace YooAsset.Editor
if (selectPackage == null)
return;
List<AssetBundleCollectorGroup> displayGroupList = null;
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
displayGroupList = new List<AssetBundleCollectorGroup>();
foreach(var group in selectPackage.Groups)
{
if(group.GroupName.ToLower().Contains(_lowerSearchKey))
{
displayGroupList.Add(group);
}
else if(group.AssetTags.ToLower().Contains(_lowerSearchKey))
{
displayGroupList.Add(group);
}
else
{
foreach(var collector in group.Collectors)
{
if(collector.CollectPath.ToLower().Contains(_lowerSearchKey))
{
displayGroupList.Add(group);
break;
}
if(collector.AssetTags.ToLower().Contains(_lowerSearchKey))
{
displayGroupList.Add(group);
break;
}
}
}
}
}
else
{
displayGroupList = selectPackage.Groups;
}
_groupListView.Clear();
_groupListView.ClearSelection();
_groupListView.itemsSource = selectPackage.Groups;
_groupListView.itemsSource = displayGroupList;
_groupListView.Rebuild();
if (_lastModifyGroupIndex >= 0 && _lastModifyGroupIndex < _groupListView.itemsSource.Count)
@@ -651,13 +801,26 @@ namespace YooAsset.Editor
if (selectPackage == null)
return;
var group = selectPackage.Groups[index];
var group = _groupListView.itemsSource[index] as AssetBundleCollectorGroup;
var textField1 = element.Q<Label>("Label1");
if (string.IsNullOrEmpty(group.GroupDesc))
textField1.text = group.GroupName;
else
textField1.text = $"{group.GroupName} ({group.GroupDesc})";
textField1.text = group.GroupName;
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
if(group.GroupName.ToLower().Contains(_lowerSearchKey))
{
ShowSearchBorder(element);
}
else
{
ClearBorder(element);
}
}
else
{
ClearBorder(element);
}
// 激活状态
IActiveRule activeRule = AssetBundleCollectorSettingData.GetActiveRuleInstance(group.ActiveRuleName);
@@ -679,8 +842,23 @@ namespace YooAsset.Editor
_groupNameTxt.SetValueWithoutNotify(selectGroup.GroupName);
_groupDescTxt.SetValueWithoutNotify(selectGroup.GroupDesc);
_groupTagsTxt.SetValueWithoutNotify(selectGroup.AssetTags);
FillCollectorViewData();
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
if(selectGroup.AssetTags.ToLower().Contains(_lowerSearchKey))
{
ShowSearchBorder(_groupTagsTxt);
}
else
{
ClearBorder(_groupTagsTxt);
}
}
else
{
ClearBorder(_groupTagsTxt);
}
FillCollectorViewData();
}
private void AddGroupBtn_clicked()
{
@@ -718,6 +896,19 @@ namespace YooAsset.Editor
_collectorScrollView.Clear();
for (int i = 0; i < selectGroup.Collectors.Count; i++)
{
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
if(selectGroup.Collectors[i].CollectPath.ToLower().Contains(_lowerSearchKey))
{
}
else if(selectGroup.Collectors[i].AssetTags.ToLower().Contains(_lowerSearchKey))
{
}
else
{
continue;
}
}
VisualElement element = MakeCollectorListViewItem();
BindCollectorListViewItem(element, i);
_collectorScrollView.Add(element);
@@ -881,11 +1072,45 @@ namespace YooAsset.Editor
// Collector Path
var objectField1 = element.Q<ObjectField>("ObjectField1");
objectField1.SetValueWithoutNotify(collectObject);
objectField1.RegisterValueChangedCallback(evt =>
if (string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
if (collector.CollectPath.ToLower().Contains(_lowerSearchKey))
{
ShowSearchBorder(objectField1);
}
else
{
ClearBorder(objectField1);
}
}
else
{
ClearBorder(objectField1);
}
objectField1.RegisterValueChangedCallback(evt =>
{
collector.CollectPath = AssetDatabase.GetAssetPath(evt.newValue);
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
objectField1.value.name = collector.CollectPath;
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
if(collector.CollectPath.ToLower().Contains(_lowerSearchKey))
{
ShowSearchBorder(objectField1);
}
else
{
ClearBorder(objectField1);
}
}
else
{
ClearBorder(objectField1);
}
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
if (foldout.value)
{
@@ -970,7 +1195,22 @@ namespace YooAsset.Editor
// Tags
var textFiled1 = element.Q<TextField>("TextField1");
textFiled1.SetValueWithoutNotify(collector.AssetTags);
if(string.IsNullOrWhiteSpace(_lowerSearchKey) == false)
{
if(collector.AssetTags.ToLower().Contains(_lowerSearchKey))
{
ShowSearchBorder(textFiled1);
}
else
{
ClearBorder(textFiled1);
}
}
else
{
ClearBorder(textFiled1);
}
textFiled1.SetValueWithoutNotify(collector.AssetTags);
textFiled1.RegisterValueChangedCallback(evt =>
{
collector.AssetTags = evt.newValue;

View File

@@ -4,6 +4,7 @@
<ui:Button text="Export" display-tooltip-when-elided="true" name="ExportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="Import" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="Fix" display-tooltip-when-elided="true" name="FixButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<uie:ToolbarSearchField name="SearchField" />
</uie:Toolbar>
<ui:VisualElement name="PublicContainer" style="background-color: rgb(79, 79, 79); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<ui:VisualElement name="HelpBoxContainer" style="flex-grow: 1;" />
@@ -28,7 +29,7 @@
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
<ui:VisualElement name="PackageContainer" style="width: 200px; flex-grow: 0; background-color: rgb(67, 67, 67); border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px;">
<ui:Label text="Packages" display-tooltip-when-elided="true" name="PackageTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:ListView focusable="true" name="PackageListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" />
<ui:ListView focusable="true" name="PackageListView" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" fixed-item-height="20" style="flex-grow: 1;" />
<ui:VisualElement name="PackageAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
@@ -38,7 +39,7 @@
<ui:Label text="Groups" display-tooltip-when-elided="true" name="GroupTitle" style="background-color: rgb(89, 89, 89); -unity-text-align: upper-center; -unity-font-style: bold; border-left-width: 5px; border-right-width: 5px; border-top-width: 5px; border-bottom-width: 5px; font-size: 12px;" />
<ui:TextField picking-mode="Ignore" label="Package Name" name="PackageName" style="flex-direction: column;" />
<ui:TextField picking-mode="Ignore" label="Package Desc" name="PackageDesc" style="flex-direction: column;" />
<ui:ListView focusable="true" name="GroupListView" item-height="20" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" style="flex-grow: 1;" />
<ui:ListView focusable="true" name="GroupListView" virtualization-method="DynamicHeight" reorderable="true" reorder-mode="Animated" fixed-item-height="20" style="flex-grow: 1;" />
<ui:VisualElement name="GroupAddContainer" style="height: 20px; flex-direction: row; justify-content: center;">
<ui:Button text=" - " display-tooltip-when-elided="true" name="RemoveBtn" />
<ui:Button text=" + " display-tooltip-when-elided="true" name="AddBtn" />
@@ -49,7 +50,7 @@
<ui:VisualElement name="ActiveRuleContainer" style="height: 20px;" />
<ui:TextField picking-mode="Ignore" label="Group Name" name="GroupName" />
<ui:TextField picking-mode="Ignore" label="Group Desc" name="GroupDesc" />
<ui:TextField picking-mode="Ignore" label="Asset Tags" name="GroupTags" />
<ui:TextField picking-mode="Ignore" label="Asset Tags" name="GroupTags" style="border-left-color: rgb(255, 255, 255); border-right-color: rgb(255, 255, 255); border-top-color: rgb(255, 255, 255); border-bottom-color: rgb(255, 255, 255); border-top-width: 0; border-right-width: 0; border-bottom-width: 0; border-left-width: 0; border-top-left-radius: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0;" />
<ui:VisualElement name="CollectorAddContainer" style="height: 20px; flex-direction: row-reverse;">
<ui:Button text="[ + ]" display-tooltip-when-elided="true" name="AddBtn" />
</ui:VisualElement>

View File

@@ -70,7 +70,7 @@ namespace YooAsset.Editor
foreach (var cacheInfoPair in _database)
{
var assetPath = cacheInfoPair.Key;
var assetGUID = AssetDatabase.AssetPathToGUID(assetPath);
var assetGUID = AssetDatabase.AssetPathToGUID(assetPath, AssetPathToGUIDOptions.OnlyExistingAssets);
if (string.IsNullOrEmpty(assetGUID))
{
removeList.Add(assetPath);

View File

@@ -296,6 +296,7 @@ namespace YooAsset.Editor
string filePath = $"{resultPath}/{nameof(DebugReport)}_{_currentReport.FrameCount}.json";
string fileContent = JsonUtility.ToJson(_currentReport, true);
FileUtility.WriteAllText(filePath, fileContent);
Debug.Log($"Debug report file saved : {filePath}");
}
}
private void OnSearchKeyWordChange(ChangeEvent<string> e)

View File

@@ -0,0 +1,42 @@
#if UNITY_2019_4_OR_NEWER
using UnityEditor;
using System;
namespace YooAsset.Editor
{
public class AssetObjectCell : ITableCell, IComparable
{
public string SearchTag { private set; get; }
public object CellValue { set; get; }
public string StringValue
{
get
{
return (string)CellValue;
}
}
public AssetObjectCell(string searchTag, string assetPath)
{
SearchTag = searchTag;
CellValue = assetPath;
}
public object GetDisplayObject()
{
return AssetDatabase.LoadMainAssetAtPath(StringValue);
}
public int CompareTo(object other)
{
if (other is AssetObjectCell cell)
{
return this.StringValue.CompareTo(cell.StringValue);
}
else
{
return 0;
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 39db4a569a0f69443a7675e19c99c389
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -31,9 +31,14 @@ namespace YooAsset.Editor
var cell = new ButtonCell(searchTag);
Cells.Add(cell);
}
public void AddAssetPathCell(string searchTag, string path)
public void AddAssetPathCell(string searchTag, string assetPath)
{
var cell = new AssetPathCell(searchTag, path);
var cell = new AssetPathCell(searchTag, assetPath);
Cells.Add(cell);
}
public void AddAssetObjectCell(string searchTag, string assetPath)
{
var cell = new AssetObjectCell(searchTag, assetPath);
Cells.Add(cell);
}
public void AddStringValueCell(string searchTag, string value)

View File

@@ -122,7 +122,7 @@ namespace YooAsset
{
if (_disableUnityWebCache)
{
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, 0);
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, Bundle.UnityCRC);
#if UNITY_2020_3_OR_NEWER
downloadhandler.autoLoadAssetBundle = false;
#endif
@@ -132,9 +132,8 @@ namespace YooAsset
{
// 注意:优先从浏览器缓存里获取文件
// The file hash defining the version of the asset bundle.
uint unityCRC = Bundle.UnityCRC;
Hash128 fileHash = Hash128.Parse(Bundle.FileHash);
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, fileHash, unityCRC);
var downloadhandler = new DownloadHandlerAssetBundle(_requestURL, fileHash, Bundle.UnityCRC);
#if UNITY_2020_3_OR_NEWER
downloadhandler.autoLoadAssetBundle = false;
#endif

View File

@@ -34,6 +34,20 @@ namespace YooAsset
return str.Remove(index); //"assets/config/test.unity3d" --> "assets/config/test"
}
/// <summary>
/// URL地址是否包含双斜杠
/// 注意:只检查协议之后的部分
/// </summary>
public static bool HasDoubleSlashes(string url)
{
if (url == null)
throw new ArgumentNullException();
int protocolIndex = url.IndexOf("://");
string partToCheck = protocolIndex == -1 ? url : url.Substring(protocolIndex + 3);
return partToCheck.Contains("//") || partToCheck.Contains(@"\\");
}
/// <summary>
/// 合并路径
/// </summary>

View File

@@ -63,6 +63,29 @@ namespace YooAsset
}
}
/// <summary>
/// 销毁资源系统
/// </summary>
public static void Destroy()
{
if (_isInitialize)
{
_isInitialize = false;
if (_driver != null)
GameObject.Destroy(_driver);
// 终止并清空所有包裹的异步操作
ClearAllPackageOperation();
// 卸载所有AssetBundle
AssetBundle.UnloadAllAssetBundles(true);
// 清空资源包裹列表
_packages.Clear();
}
}
/// <summary>
/// 更新资源系统
/// </summary>
@@ -75,11 +98,10 @@ namespace YooAsset
}
/// <summary>
/// 应用程序退出处理
/// 终止并清空所有包裹的异步操作
/// </summary>
internal static void OnApplicationQuit()
internal static void ClearAllPackageOperation()
{
// 说明在编辑器下确保播放被停止时IO类操作被终止。
foreach (var package in _packages)
{
OperationSystem.ClearPackageOperation(package.PackageName);

View File

@@ -24,7 +24,8 @@ namespace YooAsset
#if UNITY_EDITOR
void OnApplicationQuit()
{
YooAssets.OnApplicationQuit();
// 说明在编辑器下确保播放被停止时IO类操作被终止。
YooAssets.ClearAllPackageOperation();
}
#endif

View File

@@ -198,6 +198,15 @@ internal class WechatFileSystem : IFileSystem
RemoteServices = new WebRemoteServices(webRoot);
}
// 检查URL双斜杠
// 注意:双斜杠会导致微信插件加载文件失败,但网络请求又不返回失败!
{
var mainURL = RemoteServices.GetRemoteMainURL("test.bundle");
var fallbackURL = RemoteServices.GetRemoteFallbackURL("test.bundle");
if (PathUtility.HasDoubleSlashes(mainURL) || PathUtility.HasDoubleSlashes(fallbackURL))
throw new Exception($"{nameof(RemoteServices)} returned URL contains double slashes. !");
}
_fileSystemMgr = WX.GetFileSystemManager();
}
public virtual void OnDestroy()

View File

@@ -1,4 +1,4 @@
#if UNITY_EDITOR
#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
using System.IO;
using UnityEngine;
using UnityEngine.UI;
@@ -6,6 +6,11 @@ using UnityEngine.U2D;
public static class UIPanelSettings
{
/// <summary>
/// 是否开启面板监测
/// </summary>
public static bool EnablePanelMonitor = false;
/// <summary>
/// 面板文件夹GUID
/// </summary>
@@ -60,6 +65,9 @@ public class UIPanelMonitor : UnityEditor.Editor
static void OnPrefabSaving(GameObject go)
{
if (UIPanelSettings.EnablePanelMonitor == false)
return;
UnityEditor.SceneManagement.PrefabStage stage = UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage();
if (stage != null)
{
@@ -78,7 +86,7 @@ public class UIPanelMonitor : UnityEditor.Editor
/// <summary>
/// 刷新面板清单
/// </summary>
public static void RefreshPanelManifest(PanelManifest manifest)
private static void RefreshPanelManifest(PanelManifest manifest)
{
manifest.ReferencesAtlas.Clear();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 300 KiB

View File

@@ -1,7 +1,7 @@
{
"name": "com.tuyoogame.yooasset",
"displayName": "YooAsset",
"version": "2.3.8",
"version": "2.3.9",
"unity": "2019.4",
"description": "unity3d resources management system.",
"author": {