Compare commits

...

14 Commits
1.2.3 ... 1.2.4

Author SHA1 Message Date
hevinci
39c277b090 Update CHANGELOG.md 2022-09-22 15:07:39 +08:00
hevinci
81e6aab53d Update package.json 2022-09-22 15:07:09 +08:00
hevinci
7c1e1ab593 Update Basic Sample 2022-09-22 14:29:24 +08:00
hevinci
2381b67312 Update BasicSamples 2022-09-22 14:18:54 +08:00
hevinci
ca83a4450d Update Basic Samples 2022-09-22 11:42:13 +08:00
hevinci
8cec0abf0e Update AssetBundleCollector
增加配置表自我修复功能。
2022-09-22 11:40:30 +08:00
hevinci
a89127df1d Update YooAssetDriver
在游戏对象销毁的时候释放YooAssets
2022-09-21 11:36:28 +08:00
hevinci
95924868f7 Update AssetBundleCollector
移除对Gizmos资源的打包限制。
2022-09-21 11:21:13 +08:00
hevinci
778b097f7a Update TaskCreateReport.cs 2022-09-21 11:20:41 +08:00
hevinci
3a7f3bb68d Update AssetBundleBuilder
修复在可编程构建管线下模拟构建模式报错。
2022-09-21 11:20:32 +08:00
hevinci
02b9b689b7 Update AssetBundleBuilder
可编程构建管线强制使用增量构建模式。
2022-09-21 11:18:38 +08:00
hevinci
3882fe9f3f Update Samples.md 2022-09-16 11:16:22 +08:00
hevinci
af29cb738d Update AssetBundleBuilder
对内置管线构建结果做容错处理
2022-09-14 17:36:41 +08:00
hevinci
4975d3b1ba Update AssetBundleBuilder
修复加密文件下载验证失败问题。
2022-09-13 11:48:57 +08:00
41 changed files with 260 additions and 133 deletions

View File

@@ -2,6 +2,19 @@
All notable changes to this package will be documented in this file.
## [1.2.4] - 2022-09-22
### Fixed
- 修复了加密文件下载验证失败的问题。
- 修复了可编程构建管线下模拟构建模式报错的问题。
### Changed
- 可编程构建管线强制使用增量构建模式。
- 移除了对Gizmos资源的打包限制。
- AssetBundleCollector窗口增加配置表修复功能。
## [1.2.3] - 2022-09-09
### Fixed

View File

@@ -20,13 +20,19 @@ namespace YooAsset.Editor
// 检测构建参数是否为空
if (buildParameters == null)
{
throw new Exception($"{nameof(buildParameters)} is null !");
}
// 检测可编程构建管线参数
if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline)
{
if (buildParameters.SBPParameters == null)
throw new Exception($"{nameof(BuildParameters.SBPParameters)} is null !");
if (buildParameters.BuildMode == EBuildMode.DryRunBuild)
throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !");
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !");
}
// 构建参数

View File

@@ -40,21 +40,6 @@ namespace YooAsset.Editor
/// </summary>
public string ContentHash { set; get; } = "00000000000000000000000000000000"; //32位
/// <summary>
/// 文件哈希值
/// </summary>
public string FileHash { set; get; } = "00000000000000000000000000000000"; //32位
/// <summary>
/// 文件CRC32
/// </summary>
public string FileCRC { set; get; } = "00000000"; //8位
/// <summary>
/// 文件大小
/// </summary>
public long FileSize { set; get; } = 0;
public BuildBundleInfo(string bundleName)
{

View File

@@ -85,9 +85,6 @@ namespace YooAsset.Editor
if (Parameters.BuildMode == EBuildMode.SimulateBuild)
throw new Exception("Should never get here !");
if (Parameters.BuildMode == EBuildMode.DryRunBuild)
throw new Exception($"SBP not support {nameof(EBuildMode.DryRunBuild)} build mode !");
var targetGroup = BuildPipeline.GetBuildTargetGroup(Parameters.BuildTarget);
var buildParams = new UnityEditor.Build.Pipeline.BundleBuildParameters(Parameters.BuildTarget, targetGroup, PipelineOutputDirectory);
@@ -103,16 +100,9 @@ namespace YooAsset.Editor
if (Parameters.DisableWriteTypeTree)
buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.DisableWriteTypeTree;
if(Parameters.BuildMode == EBuildMode.ForceRebuild)
{
buildParams.UseCache = false;
}
else
{
buildParams.UseCache = true;
buildParams.CacheServerHost = Parameters.SBPParameters.CacheServerHost;
buildParams.CacheServerPort = Parameters.SBPParameters.CacheServerPort;
}
buildParams.UseCache = true;
buildParams.CacheServerHost = Parameters.SBPParameters.CacheServerHost;
buildParams.CacheServerPort = Parameters.SBPParameters.CacheServerPort;
buildParams.WriteLinkXML = Parameters.SBPParameters.WriteLinkXML;
return buildParams;

View File

@@ -30,6 +30,13 @@ namespace YooAsset.Editor
if (buildResults == null)
throw new Exception("构建过程中发生错误!");
if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
{
string unityOutputManifestFilePath = $"{buildParametersContext.PipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}";
if(System.IO.File.Exists(unityOutputManifestFilePath) == false)
throw new Exception("构建过程中发生严重错误!请查阅上下文日志!");
}
BuildRunner.Log("Unity引擎打包成功");
BuildResultContext buildResultContext = new BuildResultContext();
buildResultContext.UnityManifest = buildResults;
@@ -68,13 +75,10 @@ namespace YooAsset.Editor
{
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
bundleInfo.FileHash = HashUtility.FileMD5(filePath);
bundleInfo.FileCRC = HashUtility.FileCRC32(filePath);
bundleInfo.FileSize = FileUtility.GetFileSize(filePath);
if (bundleInfo.IsRawFile)
{
bundleInfo.ContentHash = bundleInfo.FileHash;
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
}
else
{

View File

@@ -79,13 +79,10 @@ namespace YooAsset.Editor
{
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
bundleInfo.FileHash = HashUtility.FileMD5(filePath);
bundleInfo.FileCRC = HashUtility.FileCRC32(filePath);
bundleInfo.FileSize = FileUtility.GetFileSize(filePath);
if (bundleInfo.IsRawFile)
{
bundleInfo.ContentHash = bundleInfo.FileHash;
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
bundleInfo.ContentHash = HashUtility.FileMD5(filePath);
}
else
{

View File

@@ -37,8 +37,11 @@ namespace YooAsset.Editor
// 更新Unity内置资源包的引用关系
if (buildParameters.Parameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline)
{
var buildResultContext = context.GetContextObject<TaskBuilding_SBP.BuildResultContext>();
UpdateBuiltInBundleReference(patchManifest, buildResultContext.Results);
if(buildParameters.Parameters.BuildMode == EBuildMode.IncrementalBuild)
{
var buildResultContext = context.GetContextObject<TaskBuilding_SBP.BuildResultContext>();
UpdateBuiltInBundleReference(patchManifest, buildResultContext.Results);
}
}
// 创建补丁清单文件
@@ -74,9 +77,9 @@ namespace YooAsset.Editor
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
var bundleName = bundleInfo.BundleName;
string fileHash = bundleInfo.FileHash;
string fileCRC = bundleInfo.FileCRC;
long fileSize = bundleInfo.FileSize;
string fileHash = GetBundleFileHash(bundleInfo, buildParameters);
string fileCRC = GetBundleFileCRC(bundleInfo, buildParameters);
long fileSize = GetBundleFileSize(bundleInfo, buildParameters);
string[] tags = buildMapContext.GetBundleTags(bundleName);
bool isEncrypted = encryptionContext.IsEncryptFile(bundleName);
bool isBuildin = IsBuildinBundle(tags, buildinTags);
@@ -102,6 +105,33 @@ namespace YooAsset.Editor
}
return false;
}
private string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return "00000000000000000000000000000000"; //32位
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
return HashUtility.FileMD5(filePath);
}
private string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return "00000000"; //8位
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
return HashUtility.FileCRC32(filePath);
}
private long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
{
var buildMode = buildParametersContext.Parameters.BuildMode;
if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
return 0;
string filePath = $"{buildParametersContext.PipelineOutputDirectory}/{bundleInfo.BundleName}";
return FileUtility.GetFileSize(filePath);
}
/// <summary>
/// 获取资源列表

View File

@@ -19,11 +19,9 @@ namespace YooAsset.Editor
{
CreateReportFile(buildParameters, buildMapContext);
}
else
{
float buildSeconds = buildParameters.GetBuildingSeconds();
BuildRunner.Info($"Build time consuming {buildSeconds} seconds.");
}
float buildSeconds = buildParameters.GetBuildingSeconds();
BuildRunner.Info($"Build time consuming {buildSeconds} seconds.");
}
private void CreateReportFile(BuildParametersContext buildParameters, BuildMapContext buildMapContext)

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace YooAsset.Editor
{
@@ -14,6 +15,11 @@ namespace YooAsset.Editor
/// </summary>
public string CollectPath = string.Empty;
/// <summary>
/// 收集器的GUID
/// </summary>
public string CollectorGUID = string.Empty;
/// <summary>
/// 收集器类型
/// </summary>
@@ -68,7 +74,8 @@ namespace YooAsset.Editor
/// </summary>
public void CheckConfigError()
{
if (AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(CollectPath) == null)
string assetGUID = AssetDatabase.AssetPathToGUID(CollectPath);
if (string.IsNullOrEmpty(assetGUID))
throw new Exception($"Invalid collect path : {CollectPath}");
if (CollectorType == ECollectorType.None)
@@ -84,6 +91,44 @@ namespace YooAsset.Editor
throw new Exception($"Invalid {nameof(IAddressRule)} class type : {AddressRuleName} in collector : {CollectPath}");
}
/// <summary>
/// 修复配置错误
/// </summary>
public bool FixConfigError()
{
bool isFixed = false;
if (string.IsNullOrEmpty(CollectorGUID) == false)
{
string convertAssetPath = AssetDatabase.GUIDToAssetPath(CollectorGUID);
if (string.IsNullOrEmpty(convertAssetPath))
{
Debug.LogWarning($"Collector GUID {CollectorGUID} is invalid and has been auto removed !");
CollectorGUID = string.Empty;
isFixed = true;
}
else
{
if (CollectPath != convertAssetPath)
{
CollectPath = convertAssetPath;
isFixed = true;
Debug.LogWarning($"Fix collect path : {CollectPath} -> {convertAssetPath}");
}
}
}
/*
string convertGUID = AssetDatabase.AssetPathToGUID(CollectPath);
if(string.IsNullOrEmpty(convertGUID) == false)
{
CollectorGUID = convertGUID;
}
*/
return isFixed;
}
/// <summary>
/// 获取打包收集的资源文件
/// </summary>
@@ -184,11 +229,6 @@ namespace YooAsset.Editor
UnityEngine.Debug.LogError($"Invalid asset path : {assetPath}");
return false;
}
if (assetPath.Contains("/Gizmos/"))
{
UnityEngine.Debug.LogWarning($"Cannot pack gizmos asset : {assetPath}");
return false;
}
// 忽略文件夹
if (AssetDatabase.IsValidFolder(assetPath))

View File

@@ -20,12 +20,13 @@ namespace YooAsset.Editor
public const string XmlGroupDesc = "GroupDesc";
public const string XmlCollector = "Collector";
public const string XmlCollectPath = "CollectPath";
public const string XmlCollectorGUID = "CollectGUID";
public const string XmlCollectorType = "CollectType";
public const string XmlAddressRule = "AddressRule";
public const string XmlPackRule = "PackRule";
public const string XmlFilterRule = "FilterRule";
public const string XmlAssetTags = "AssetTags";
/// <summary>
/// 导入XML配置表
/// </summary>
@@ -44,7 +45,7 @@ namespace YooAsset.Editor
// 读取配置版本
string configVersion = root.GetAttribute(XmlVersion);
if(configVersion != ConfigVersion)
if (configVersion != ConfigVersion)
{
throw new Exception($"The config version is invalid : {configVersion}");
}
@@ -97,13 +98,18 @@ namespace YooAsset.Editor
if (collectorElement.HasAttribute(XmlAssetTags) == false)
throw new Exception($"Not found attribute {XmlAssetTags} in {XmlCollector}");
string collectorGUID = string.Empty;
if (collectorElement.HasAttribute(XmlCollectorGUID))
collectorGUID = collectorElement.GetAttribute(XmlCollectorGUID);
AssetBundleCollector collector = new AssetBundleCollector();
collector.CollectPath = collectorElement.GetAttribute(XmlCollectPath);
collector.CollectorGUID = collectorGUID;
collector.CollectorType = StringUtility.NameToEnum<ECollectorType>(collectorElement.GetAttribute(XmlCollectorType));
collector.AddressRuleName = collectorElement.GetAttribute(XmlAddressRule);
collector.PackRuleName = collectorElement.GetAttribute(XmlPackRule);
collector.FilterRuleName = collectorElement.GetAttribute(XmlFilterRule);
collector.AssetTags = collectorElement.GetAttribute(XmlAssetTags); ;
collector.AssetTags = collectorElement.GetAttribute(XmlAssetTags);
group.Collectors.Add(collector);
}
}
@@ -155,6 +161,7 @@ namespace YooAsset.Editor
{
var collectorElement = xmlDoc.CreateElement(XmlCollector);
collectorElement.SetAttribute(XmlCollectPath, collector.CollectPath);
collectorElement.SetAttribute(XmlCollectorGUID, collector.CollectorGUID);
collectorElement.SetAttribute(XmlCollectorType, collector.CollectorType.ToString());
collectorElement.SetAttribute(XmlAddressRule, collector.AddressRuleName);
collectorElement.SetAttribute(XmlPackRule, collector.PackRuleName);

View File

@@ -30,6 +30,26 @@ namespace YooAsset.Editor
}
}
/// <summary>
/// 修复配置错误
/// </summary>
public bool FixConfigError()
{
bool result = false;
foreach (var group in Groups)
{
foreach (var collector in group.Collectors)
{
bool isFixed = collector.FixConfigError();
if (isFixed)
{
result = true;
}
}
}
return result;
}
/// <summary>
/// 获取所有的资源标签
/// </summary>

View File

@@ -232,7 +232,7 @@ namespace YooAsset.Editor
}
/// <summary>
/// 存储文件
/// 存储配置文件
/// </summary>
public static void SaveFile()
{
@@ -245,6 +245,18 @@ namespace YooAsset.Editor
}
}
/// <summary>
/// 修复配置文件
/// </summary>
public static void FixFile()
{
bool isFixed = Setting.FixConfigError();
if (isFixed)
{
IsDirty = true;
}
}
/// <summary>
/// 清空所有数据
/// </summary>
@@ -360,10 +372,9 @@ namespace YooAsset.Editor
}
// 资源收集器编辑相关
public static void CreateCollector(AssetBundleCollectorGroup group, string collectPath)
public static void CreateCollector(AssetBundleCollectorGroup group)
{
AssetBundleCollector collector = new AssetBundleCollector();
collector.CollectPath = collectPath;
group.Collectors.Add(collector);
IsDirty = true;
}

View File

@@ -62,6 +62,10 @@ namespace YooAsset.Editor
visualAsset.CloneTree(root);
// 配置修复按钮
var fixBtn = root.Q<Button>("FixButton");
fixBtn.clicked += FixBtn_clicked;
// 导入导出按钮
var exportBtn = root.Q<Button>("ExportButton");
exportBtn.clicked += ExportBtn_clicked;
@@ -209,6 +213,10 @@ namespace YooAsset.Editor
FillGroupViewData();
}
private void FixBtn_clicked()
{
AssetBundleCollectorSettingData.FixFile();
}
private void ExportBtn_clicked()
{
string resultPath = EditorTools.OpenFolderPanel("Export XML", "Assets/");
@@ -472,6 +480,7 @@ namespace YooAsset.Editor
objectField1.RegisterValueChangedCallback(evt =>
{
collector.CollectPath = AssetDatabase.GetAssetPath(evt.newValue);
collector.CollectorGUID = AssetDatabase.AssetPathToGUID(collector.CollectPath);
objectField1.value.name = collector.CollectPath;
AssetBundleCollectorSettingData.ModifyCollector(selectGroup, collector);
if (foldout.value)
@@ -602,7 +611,7 @@ namespace YooAsset.Editor
return;
Undo.RecordObject(AssetBundleCollectorSettingData.Setting, "YooAsset.AssetBundleCollectorWindow AddCollector");
AssetBundleCollectorSettingData.CreateCollector(selectGroup, string.Empty);
AssetBundleCollectorSettingData.CreateCollector(selectGroup);
FillCollectorViewData();
}
private void RemoveCollectorBtn_clicked(AssetBundleCollector selectCollector)

View File

@@ -3,6 +3,7 @@
<ui:Button text="Save" display-tooltip-when-elided="true" name="SaveButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="导出" display-tooltip-when-elided="true" name="ExportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="导入" display-tooltip-when-elided="true" name="ImportButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
<ui:Button text="修复" display-tooltip-when-elided="true" name="FixButton" style="width: 50px; background-color: rgb(56, 147, 58);" />
</uie:Toolbar>
<ui:VisualElement name="ContentContainer" style="flex-grow: 1; flex-direction: row;">
<ui:VisualElement name="LeftContainer" 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;">

View File

@@ -9,6 +9,11 @@ namespace YooAsset
YooAssets.InternalUpdate();
}
void OnDestroy()
{
YooAssets.InternalDestroy();
}
void OnApplicationQuit()
{
YooAssets.InternalDestroy();

View File

@@ -1072,21 +1072,24 @@ namespace YooAsset
#region
internal static void InternalDestroy()
{
_isInitialize = false;
_initializeError = string.Empty;
_initializeStatus = EOperationStatus.None;
if (_isInitialize)
{
_isInitialize = false;
_initializeError = string.Empty;
_initializeStatus = EOperationStatus.None;
_bundleServices = null;
_locationServices = null;
_editorSimulateModeImpl = null;
_offlinePlayModeImpl = null;
_hostPlayModeImpl = null;
_bundleServices = null;
_locationServices = null;
_editorSimulateModeImpl = null;
_offlinePlayModeImpl = null;
_hostPlayModeImpl = null;
OperationSystem.DestroyAll();
DownloadSystem.DestroyAll();
CacheSystem.DestroyAll();
AssetSystem.DestroyAll();
YooLogger.Log("YooAssets destroy all !");
OperationSystem.DestroyAll();
DownloadSystem.DestroyAll();
CacheSystem.DestroyAll();
AssetSystem.DestroyAll();
YooLogger.Log("YooAssets destroy all !");
}
}
internal static void InternalUpdate()
{
@@ -1136,7 +1139,7 @@ namespace YooAsset
private static void DebugCheckUpdateManifest()
{
var loadedBundleInfos = AssetSystem.GetLoadedBundleInfos();
if(loadedBundleInfos.Count > 0)
if (loadedBundleInfos.Count > 0)
{
YooLogger.Warning($"Found loaded bundle before update manifest ! Recommended to call the {nameof(ForceUnloadAllAssets)} method to release loaded bundle !");
}

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -40,7 +40,7 @@ public class BootScene : MonoBehaviour
if (PlayMode == YooAssets.EPlayMode.EditorSimulateMode)
{
var createParameters = new YooAssets.EditorSimulateModeParameters();
createParameters.LocationServices = new DefaultLocationServices("Assets/Samples/BasicSample/GameRes");
createParameters.LocationServices = new AddressLocationServices();
//createParameters.SimulatePatchManifestPath = GetPatchManifestPath();
yield return YooAssets.InitializeAsync(createParameters);
}
@@ -49,7 +49,7 @@ public class BootScene : MonoBehaviour
if (PlayMode == YooAssets.EPlayMode.OfflinePlayMode)
{
var createParameters = new YooAssets.OfflinePlayModeParameters();
createParameters.LocationServices = new DefaultLocationServices("Assets/Samples/BasicSample/GameRes");
createParameters.LocationServices = new AddressLocationServices();
yield return YooAssets.InitializeAsync(createParameters);
}
@@ -57,7 +57,7 @@ public class BootScene : MonoBehaviour
if (PlayMode == YooAssets.EPlayMode.HostPlayMode)
{
var createParameters = new YooAssets.HostPlayModeParameters();
createParameters.LocationServices = new DefaultLocationServices("Assets/Samples/BasicSample/GameRes");
createParameters.LocationServices = new AddressLocationServices();
createParameters.DecryptionServices = null;
createParameters.ClearCacheWhenDirty = false;
createParameters.DefaultHostServer = GetHostServerURL();

View File

@@ -6,7 +6,7 @@ using UnityEngine.U2D;
using UnityEngine.UI;
using YooAsset;
public class Game1Scene : MonoBehaviour
public class GameScene1 : MonoBehaviour
{
public GameObject CanvasRoot;
@@ -72,7 +72,7 @@ public class Game1Scene : MonoBehaviour
#if UNITY_WEBGL
{
var rawImage = CanvasRoot.transform.Find("background").GetComponent<RawImage>();
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Texture>("Texture/bg");
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Texture>("tex_bg");
_cachedAssetOperationHandles.Add(handle);
handle.Completed += (AssetOperationHandle obj) =>
{
@@ -82,7 +82,7 @@ public class Game1Scene : MonoBehaviour
#else
{
var rawImage = CanvasRoot.transform.Find("background").GetComponent<RawImage>();
AssetOperationHandle handle = YooAssets.LoadAssetSync<Texture>("Texture/bg");
AssetOperationHandle handle = YooAssets.LoadAssetSync<Texture>("tex_bg");
_cachedAssetOperationHandles.Add(handle);
rawImage.texture = handle.AssetObject as Texture;
}
@@ -92,7 +92,7 @@ public class Game1Scene : MonoBehaviour
#if UNITY_WEBGL
{
var logoImage = CanvasRoot.transform.Find("title/logo").GetComponent<Image>();
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Sprite>("Texture/logo.png");
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Sprite>("tex_logo");
_cachedAssetOperationHandles.Add(handle);
handle.Completed += (AssetOperationHandle obj) =>
{
@@ -102,7 +102,7 @@ public class Game1Scene : MonoBehaviour
#else
{
var logoImage = CanvasRoot.transform.Find("title/logo").GetComponent<Image>();
AssetOperationHandle handle = YooAssets.LoadAssetSync<Sprite>("Texture/logo.png");
AssetOperationHandle handle = YooAssets.LoadAssetSync<Sprite>("tex_logo");
_cachedAssetOperationHandles.Add(handle);
logoImage.sprite = handle.AssetObject as Sprite;
}
@@ -112,10 +112,10 @@ public class Game1Scene : MonoBehaviour
{
string[] entityAssetNames =
{
"Level1/footman_Blue",
"Level2/footman_Green",
"Level3/footman_Red",
"Level3/footman_Yellow"
"footman_Blue",
"footman_Green",
"footman_Red",
"footman_Yellow"
};
var btn = CanvasRoot.transform.Find("load_npc/btn").GetComponent<Button>();
@@ -123,7 +123,7 @@ public class Game1Scene : MonoBehaviour
{
#if UNITY_WEBGL
var icon = CanvasRoot.transform.Find("load_npc/icon").GetComponent<Image>();
AssetOperationHandle handle = YooAssets.LoadAssetAsync<GameObject>($"Entity/{entityAssetNames[_npcIndex]}");
AssetOperationHandle handle = YooAssets.LoadAssetAsync<GameObject>($"{entityAssetNames[_npcIndex]}");
_cachedAssetOperationHandles.Add(handle);
handle.Completed += (AssetOperationHandle op) =>
{
@@ -134,7 +134,7 @@ public class Game1Scene : MonoBehaviour
};
#else
var icon = CanvasRoot.transform.Find("load_npc/icon").GetComponent<Image>();
AssetOperationHandle handle = YooAssets.LoadAssetSync<GameObject>($"Entity/{entityAssetNames[_npcIndex]}");
AssetOperationHandle handle = YooAssets.LoadAssetSync<GameObject>($"{entityAssetNames[_npcIndex]}");
_cachedAssetOperationHandles.Add(handle);
GameObject go = handle.InstantiateSync(icon.transform);
go.transform.localPosition = new Vector3(0, -50, -100);
@@ -152,7 +152,7 @@ public class Game1Scene : MonoBehaviour
var btn = CanvasRoot.transform.Find("load_unity_atlas/btn").GetComponent<Button>();
btn.onClick.AddListener(() =>
{
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Sprite>("UISprite/Icon_Leafs_128");
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Sprite>("Icon_Leafs_128");
_cachedAssetOperationHandles.Add(handle);
handle.Completed += OnUnityAtlas_Completed;
});
@@ -163,7 +163,7 @@ public class Game1Scene : MonoBehaviour
var btn = CanvasRoot.transform.Find("load_tp_atlas/btn").GetComponent<Button>();
btn.onClick.AddListener(() =>
{
SubAssetsOperationHandle handle = YooAssets.LoadSubAssetsAsync<Sprite>("TpAtlas/tpAtlas");
SubAssetsOperationHandle handle = YooAssets.LoadSubAssetsAsync<Sprite>("tpAtlas");
_cachedSubAssetsOperationHandles.Add(handle);
handle.Completed += OnTpAtlasAsset_Completed;
});
@@ -175,7 +175,7 @@ public class Game1Scene : MonoBehaviour
btn.onClick.AddListener(() =>
{
string savePath = $"{YooAssets.GetSandboxRoot()}/config1.txt";
RawFileOperation operation = YooAssets.GetRawFileAsync("Config/config1.txt", savePath);
RawFileOperation operation = YooAssets.GetRawFileAsync("config1", savePath);
operation.Completed += OnRawFile_Completed;
});
}
@@ -185,7 +185,7 @@ public class Game1Scene : MonoBehaviour
var btn = CanvasRoot.transform.Find("load_scene").GetComponent<Button>();
btn.onClick.AddListener(() =>
{
YooAssets.LoadSceneAsync("Scene/Game2.unity");
YooAssets.LoadSceneAsync("GameScene2");
});
}
}
@@ -215,7 +215,7 @@ public class Game1Scene : MonoBehaviour
// 加载背景音乐
{
var audioSource = CanvasRoot.transform.Find("music").GetComponent<AudioSource>();
AssetOperationHandle handle = YooAssets.LoadAssetAsync<AudioClip>("Music/town");
AssetOperationHandle handle = YooAssets.LoadAssetAsync<AudioClip>("music_town");
_cachedAssetOperationHandles.Add(handle);
await handle.Task;
audioSource.clip = handle.AssetObject as AudioClip;

View File

@@ -6,7 +6,7 @@ using UnityEngine.U2D;
using UnityEngine.UI;
using YooAsset;
public class Game2Scene : MonoBehaviour
public class GameScene2 : MonoBehaviour
{
public GameObject CanvasRoot;
private readonly List<AssetOperationHandle> _cachedAssetOperationHandles = new List<AssetOperationHandle>(1000);
@@ -41,7 +41,7 @@ public class Game2Scene : MonoBehaviour
#if UNITY_WEBGL
{
var rawImage = CanvasRoot.transform.Find("background").GetComponent<RawImage>();
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Texture>("Texture/bg");
AssetOperationHandle handle = YooAssets.LoadAssetAsync<Texture>("tex_bg");
_cachedAssetOperationHandles.Add(handle);
handle.Completed += (AssetOperationHandle obj) =>
{
@@ -51,7 +51,7 @@ public class Game2Scene : MonoBehaviour
#else
{
var rawImage = CanvasRoot.transform.Find("background").GetComponent<RawImage>();
AssetOperationHandle handle = YooAssets.LoadAssetSync<Texture>("Texture/bg");
AssetOperationHandle handle = YooAssets.LoadAssetSync<Texture>("tex_bg");
_cachedAssetOperationHandles.Add(handle);
rawImage.texture = handle.AssetObject as Texture;
}
@@ -62,7 +62,7 @@ public class Game2Scene : MonoBehaviour
var btn = CanvasRoot.transform.Find("load_scene").GetComponent<Button>();
btn.onClick.AddListener(() =>
{
YooAssets.LoadSceneAsync("Scene/Game1");
YooAssets.LoadSceneAsync("GameScene1");
});
}
@@ -71,7 +71,7 @@ public class Game2Scene : MonoBehaviour
var btn = CanvasRoot.transform.Find("subSceneLoadBtn").GetComponent<Button>();
btn.onClick.AddListener(() =>
{
var subSceneHandle = YooAssets.LoadSceneAsync("Scene/SubScene", UnityEngine.SceneManagement.LoadSceneMode.Additive);
var subSceneHandle = YooAssets.LoadSceneAsync("SubScene", UnityEngine.SceneManagement.LoadSceneMode.Additive);
_subSceneHandles.Add(subSceneHandle);
});
}
@@ -98,7 +98,7 @@ public class Game2Scene : MonoBehaviour
// 加载背景音乐
{
var audioSource = CanvasRoot.transform.Find("music").GetComponent<AudioSource>();
AssetOperationHandle handle = YooAssets.LoadAssetAsync<AudioClip>("Music/town");
AssetOperationHandle handle = YooAssets.LoadAssetAsync<AudioClip>("music_town");
_cachedAssetOperationHandles.Add(handle);
yield return handle;
audioSource.clip = handle.AssetObject as AudioClip;

View File

@@ -11,7 +11,7 @@ internal class FsmPatchDone : IFsmNode
PatchEventDispatcher.SendPatchStepsChangeMsg(EPatchStates.PatchDone);
Debug.Log("补丁流程更新完毕!");
YooAsset.YooAssets.LoadSceneAsync("Scene/Game1");
YooAsset.YooAssets.LoadSceneAsync("GameScene1");
}
void IFsmNode.OnUpdate()
{

View File

@@ -13,9 +13,9 @@ MonoBehaviour:
m_Name: AssetBundleBuilderSetting
m_EditorClassIdentifier:
BuildVersion: 100
BuildPipeline: 1
BuildPipeline: 0
BuildMode: 0
BuildTags: buildin;
CompressOption: 2
OutputNameStyle: 1
EncyptionClassName: EncryptionNone
AppendExtension: 0

View File

@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<root Version="1.0">
<Common AutoAddressable="False" AutoCollectShader="True" ShaderBundleName="myshaders" />
<Common AutoAddressable="True" />
<Group GroupName="Level" GroupDesc="关卡资源" AssetTags="level">
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/Entity/Level1" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectPrefab" AssetTags="level1" />
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/Entity/Level2" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectPrefab" AssetTags="level2" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/Entity/Level1" CollectGUID="724066efe61192e43a0d7e59166b36a4" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectPrefab" AssetTags="level1" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/Entity/Level2" CollectGUID="8045c1986f0ae964f8b1ea29e3522388" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectPrefab" AssetTags="level2" />
</Group>
<Group GroupName="Buildin" GroupDesc="首包资源" AssetTags="buildin">
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/Scene" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectScene" AssetTags="" />
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/Config" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackRawFile" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/Music" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/Scene" CollectGUID="f75e7d64104fb1a48b849b72b84ade4c" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackSeparately" FilterRule="CollectScene" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/Config" CollectGUID="44774abdee2b91b45b42f9dadf8c17a4" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackRawFile" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/Music" CollectGUID="e05b02ee4d90ae84a99871ce75288ea2" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
</Group>
<Group GroupName="Panel" GroupDesc="面板资源" AssetTags="panel">
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/Texture" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackCollector" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/TpAtlas" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/UIPanel" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/Samples/Basic Sample/GameRes/UISprite" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/Texture" CollectGUID="69b046f60ca75f647b2963e0113fd779" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackCollector" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/TpAtlas" CollectGUID="06e38aac2570d2b4a97c6a90223e5344" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/UIPanel" CollectGUID="926d3203fcefdb947881a7491496e039" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameRes/UISprite" CollectGUID="29f27e4abf667c04b88a3996d8cdadfc" CollectType="MainAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
</Group>
<Group GroupName="Art" GroupDesc="美术资源" AssetTags="">
<Collector CollectPath="Assets/Samples/Basic Sample/GameArt/ShaderVariants" CollectType="StaticAssetCollector" AddressRule="AddressByFileName" PackRule="PackShaderVariants" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/Samples/Basic Sample/GameArt/UIFont" CollectType="DependAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameArt/ShaderVariants" CollectGUID="00781758c26692e40a9634ddeac838be" CollectType="StaticAssetCollector" AddressRule="AddressByFileName" PackRule="PackShaderVariants" FilterRule="CollectAll" AssetTags="" />
<Collector CollectPath="Assets/YooAsset/Samples/Basic Sample/GameArt/UIFont" CollectGUID="464727a15e4a7dc4d895346374432399" CollectType="DependAssetCollector" AddressRule="AddressByFileName" PackRule="PackDirectory" FilterRule="CollectAll" AssetTags="" />
</Group>
</root>

View File

@@ -12,22 +12,22 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 185f6993d5150494d98da50e26cb1c25, type: 3}
m_Name: AssetBundleCollectorSetting
m_EditorClassIdentifier:
EnableAddressable: 0
AutoCollectShaders: 1
ShadersBundleName: myshaders
EnableAddressable: 1
Groups:
- GroupName: Level
GroupDesc: "\u5173\u5361\u8D44\u6E90"
AssetTags: level
ActiveRuleName: EnableGroup
Collectors:
- CollectPath: Assets/Samples/Basic Sample/GameRes/Entity/Level1
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Entity/Level1
CollectorGUID: 724066efe61192e43a0d7e59166b36a4
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackSeparately
FilterRuleName: CollectPrefab
AssetTags: level1
- CollectPath: Assets/Samples/Basic Sample/GameRes/Entity/Level2
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Entity/Level2
CollectorGUID: 8045c1986f0ae964f8b1ea29e3522388
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackSeparately
@@ -38,19 +38,22 @@ MonoBehaviour:
AssetTags: buildin
ActiveRuleName: EnableGroup
Collectors:
- CollectPath: Assets/Samples/Basic Sample/GameRes/Scene
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Scene
CollectorGUID: f75e7d64104fb1a48b849b72b84ade4c
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackSeparately
FilterRuleName: CollectScene
AssetTags:
- CollectPath: Assets/Samples/Basic Sample/GameRes/Config
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Config
CollectorGUID: 44774abdee2b91b45b42f9dadf8c17a4
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackRawFile
FilterRuleName: CollectAll
AssetTags:
- CollectPath: Assets/Samples/Basic Sample/GameRes/Music
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Music
CollectorGUID: e05b02ee4d90ae84a99871ce75288ea2
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
@@ -61,25 +64,29 @@ MonoBehaviour:
AssetTags: panel
ActiveRuleName: EnableGroup
Collectors:
- CollectPath: Assets/Samples/Basic Sample/GameRes/Texture
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/Texture
CollectorGUID: 69b046f60ca75f647b2963e0113fd779
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackCollector
FilterRuleName: CollectAll
AssetTags:
- CollectPath: Assets/Samples/Basic Sample/GameRes/TpAtlas
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/TpAtlas
CollectorGUID: 06e38aac2570d2b4a97c6a90223e5344
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
FilterRuleName: CollectAll
AssetTags:
- CollectPath: Assets/Samples/Basic Sample/GameRes/UIPanel
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/UIPanel
CollectorGUID: 926d3203fcefdb947881a7491496e039
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
FilterRuleName: CollectAll
AssetTags:
- CollectPath: Assets/Samples/Basic Sample/GameRes/UISprite
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameRes/UISprite
CollectorGUID: 29f27e4abf667c04b88a3996d8cdadfc
CollectorType: 0
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory
@@ -90,13 +97,15 @@ MonoBehaviour:
AssetTags:
ActiveRuleName: EnableGroup
Collectors:
- CollectPath: Assets/Samples/Basic Sample/GameArt/ShaderVariants
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameArt/ShaderVariants
CollectorGUID: 00781758c26692e40a9634ddeac838be
CollectorType: 1
AddressRuleName: AddressByFileName
PackRuleName: PackShaderVariants
FilterRuleName: CollectAll
AssetTags:
- CollectPath: Assets/Samples/Basic Sample/GameArt/UIFont
- CollectPath: Assets/YooAsset/Samples/Basic Sample/GameArt/UIFont
CollectorGUID: 464727a15e4a7dc4d895346374432399
CollectorType: 2
AddressRuleName: AddressByFileName
PackRuleName: PackDirectory

View File

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

View File

@@ -15,5 +15,4 @@
![image](./Image/Samples-img2.png)
1. Basic Sample在导入完成后需要移动目录。
2. 移除Basic Sample文件夹名称里的空格。
3. 找到Boot.scene场景启动游戏。