tuyoogame / yooasset Goto Github PK
View Code? Open in Web Editor NEWunity3d resources management system
Home Page: https://www.yooasset.com/
License: Apache License 2.0
unity3d resources management system
Home Page: https://www.yooasset.com/
License: Apache License 2.0
支持在WebGL加载AssetBundle吗
在联机运行模式下,YooAsset已经初始化了,一段时间后,服务器有一个新的DefaultHostServer,如何将新的DefaultHostServer更新到YooAsset?
原本想着调用YooAsset.AssetsPackage.InitializeAsync 更新DefaultHostServer,但是会报错(AssetsPackage is initialized yet)
System.Exception: AssetsPackage is initialized yet.
at YooAsset.AssetsPackage.CheckInitializeParameters (YooAsset.InitializeParameters parameters) [0x00000] in <00000000000000000000000000000000>:0
at YooAsset.AssetsPackage.InitializeAsync (YooAsset.InitializeParameters parameters) [0x00000] in <00000000000000000000000000000000>:0
请问这种情况要怎么处理?
InitializeAsync,操作需要获取到version文件。在webgl下StreamingAssets也是通过网络下载的,也会出现网络问题导致无法正常下载到。这时会导致初始化失败,需要添加重试或者销毁操作。
/// <summary>
/// 开启一个异步操作
/// </summary>
/// <param name="operation">异步操作对象</param>
public static void StartOperaiton(GameAsyncOperation operation)
{
OperationSystem.StartOperaiton(operation);
}
如果这个资源压根不存在(无法通过路由索引到"aaa"这个场景时),UniTask一直处于挂起状态,而合理的预期应该是处于Fail状态。
原因是由于
AssetSystem.cs 140行左右的代码:在判断assetInfo.IsInvalid之后生成了一个CompletedProvider,但是并没有将其加入到Update队列中,导致这个玩意的State一直是None,从而卡死UniTask。UniTask必须得是IsDone才会往下走呀
https://docs.unity3d.com/Manual/cus-layout.html
方便使用 git 地址直接引用
图集A打包成一个assetbundle,设置成MainAssetCollector,后续需要代码动态加载。
预制体B引用图集A的spriteC,打包成一个assetbundle,设置成MainAssetCollector。
发现spriteC被抽出来单独打成一个。
用assetStudio查看shareAssetBundle,看起来就只有sprite本身信息,没有texture。
表现:
editor上走assetbundle是正常的。
类似addressable加载不同项目的catalog
资源组名称更改删掉一个字符就弹个保存,体验有些不太好 除了冲进json改名字 还有其他比较优雅的方式吗
**SimulateBuild pipeline build failed !** UnityEngine.Debug:LogWarning (object) YooAsset.Editor.AssetBundleBuilder:Run (YooAsset.Editor.BuildParameters) (at Library/PackageCache/[email protected]/Editor/AssetBundleBuilder/AssetBundleBuilder.cs:96) YooAsset.Editor.AssetBundleSimulateBuilder:SimulateBuild (string) (at Library/PackageCache/[email protected]/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs:23) System.Reflection.MethodBase:Invoke (object,object[]) YooAsset.EditorSimulateModeHelper:InvokePublicStaticMethod (System.Type,string,object[]) (at Library/PackageCache/[email protected]/Runtime/PatchSystem/PlayMode/EditorSimulateModeHelper.cs:30) YooAsset.EditorSimulateModeHelper:SimulateBuild (string) (at Library/PackageCache/[email protected]/Runtime/PatchSystem/PlayMode/EditorSimulateModeHelper.cs:18) Main.GamePatches.GamePatch/<Start>d__3:MoveNext () (at Assets/Scripts/Main/GamePatches/GamePatch.cs:51) UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
**Build task failed : TaskPrepare** UnityEngine.Debug:LogError (object) YooAsset.Editor.AssetBundleBuilder:Run (YooAsset.Editor.BuildParameters) (at Library/PackageCache/[email protected]/Editor/AssetBundleBuilder/AssetBundleBuilder.cs:97) YooAsset.Editor.AssetBundleSimulateBuilder:SimulateBuild (string) (at Library/PackageCache/[email protected]/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs:23) System.Reflection.MethodBase:Invoke (object,object[]) YooAsset.EditorSimulateModeHelper:InvokePublicStaticMethod (System.Type,string,object[]) (at Library/PackageCache/[email protected]/Runtime/PatchSystem/PlayMode/EditorSimulateModeHelper.cs:30) YooAsset.EditorSimulateModeHelper:SimulateBuild (string) (at Library/PackageCache/[email protected]/Runtime/PatchSystem/PlayMode/EditorSimulateModeHelper.cs:18) Main.GamePatches.GamePatch/<Start>d__3:MoveNext () (at Assets/Scripts/Main/GamePatches/GamePatch.cs:51) UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
**Build task error : System.Exception: Unity2021 or newer not support BuiltinBuildPipeline, Please use ScriptableBuildPipeline** at YooAsset.Editor.TaskPrepare.YooAsset.Editor.IBuildTask.Run (YooAsset.Editor.BuildContext context) [0x00023] in E:\Work\WOWFirst\Client\Library\PackageCache\[email protected]\Editor\AssetBundleBuilder\BuildTasks\TaskPrepare.cs:21 at YooAsset.Editor.BuildRunner.Run (System.Collections.Generic.List
1[T] pipeline, YooAsset.Editor.BuildContext context) [0x0006d] in E:\Work\WOWFirst\Client\Library\PackageCache\[email protected]\Editor\AssetBundleBuilder\BuildSystem\BuildRunner.cs:33
UnityEngine.Debug:LogError (object)
YooAsset.Editor.AssetBundleBuilder:Run (YooAsset.Editor.BuildParameters) (at Library/PackageCache/[email protected]/Editor/AssetBundleBuilder/AssetBundleBuilder.cs:98)
YooAsset.Editor.AssetBundleSimulateBuilder:SimulateBuild (string) (at Library/PackageCache/[email protected]/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs:23)
System.Reflection.MethodBase:Invoke (object,object[])
YooAsset.EditorSimulateModeHelper:InvokePublicStaticMethod (System.Type,string,object[]) (at Library/PackageCache/[email protected]/Runtime/PatchSystem/PlayMode/EditorSimulateModeHelper.cs:30)
YooAsset.EditorSimulateModeHelper:SimulateBuild (string) (at Library/PackageCache/[email protected]/Runtime/PatchSystem/PlayMode/EditorSimulateModeHelper.cs:18)
Main.GamePatches.GamePatch/d__3:MoveNext () (at Assets/Scripts/Main/GamePatches/GamePatch.cs:51)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
`
Exception: SimulatePatchManifestPath is null or empty. YooAsset.AssetsPackage.CheckInitializeParameters (YooAsset.InitializeParameters parameters) (at Library/PackageCache/[email protected]/Runtime/AssetsPackage.cs:160) YooAsset.AssetsPackage.InitializeAsync (YooAsset.InitializeParameters parameters) (at Library/PackageCache/[email protected]/Runtime/AssetsPackage.cs:80) Main.GamePatches.GamePatch+<Start>d__3.MoveNext () (at Assets/Scripts/Main/GamePatches/GamePatch.cs:55) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <7b2a272e51214e2f91bbc4fb4f28eff8>:0)
编辑器模拟运行 报错
退回1.4.1后正常
webgl平台,RawFile解压失败,报错:
Error while downloading Asset Bundle: Failed to decompress data for the AssetBundle
Assets\YooAsset\Editor\AssetBundleBuilder\BuildTasks\SBPBuildTasks.cs(27,23): error CS0246: The type or namespace name 'CalculateCustomDependencyData' could not be found (are you missing a using directive or an assembly reference?)
Assets\YooAsset\Editor\AssetBundleBuilder\BuildTasks\SBPBuildTasks.cs(46,23): error CS0246: The type or namespace name 'GenerateLinkXml' could not be found (are you missing a using directive or an assembly reference?)
Assets\YooAsset\Editor\AssetBundleBuilder\BuildParametersContext.cs(116,16): error CS1061: 'BundleBuildParameters' does not contain a definition for 'WriteLinkXML' and no accessible extension method 'WriteLinkXML' accepting a first argument of type 'BundleBuildParameters' could be found (are you missing a using directive or an assembly reference?)
由于引用计数方案大多都是加载和卸载成对出现。但是实际项目中往往还是会出现很多只加载不释放或释放次数多的问题。请问yooasset在资源卸载方面有自动管理的模块吗?或者有什么好的一些解决方案?而不是说通过工具去查泄露找问题来修改。
当项目中有多个package 会触发枚举异常 在YooAsset的Update方法 把 foreach 修改为 for 可以解决
private void OnRawFile_Completed(AsyncOperationBase operation)
{
var hint = CanvasRoot.transform.Find("config/icon/hint").GetComponent<Text>();
RawFileOperation op = operation as RawFileOperation;
Debug.Log($"Load RawFile Config IsNullOrEmpyt = {String.IsNullOrEmpty(op.GetFileText())}");
hint.text = op.GetFileText();
}
Load RawFile Config IsNullOrEmpyt = True
UnityEngine.Debug:Log (object)
打包后发现小图和大图都被一起打包了
资源组的真实作用是什么?我看有个issues有提到可以实现类似变体的功能。有具体的相关文档嘛?在什么样的场景下收集器需要开启资源分组?
如果工程里没有 shader 的话,构建会报异常:
Build task error : System.Exception: 没有发现着色器资源包! at YooAsset.Editor.TaskCreatePatchManifest.UpdateBuiltInBundleReference (YooAsset.PatchManifest patchManifest, UnityEditor.Build.Pipeline.Interfaces.IBundleBuildResults buildResults) [0x000bb] in /Unity/Assets/Scripts/Editor/YooAssetEditor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs:179
变体需求现在如何处理
一个简单的例子
Prefab PA,PB
Material MA,MB
Texture TA,TB
PA依赖MA,MB
PB依赖MB
MA依赖TA,
MB依赖TB
PA 打bundle到 bundle_PA中
PB打bundle到 bundle_PB中
MA,MB 打bundle到 bundle_MAT中
TA 打bundle到 bundle_TA中
TB打bundle到 bundle_TB中
PA 依赖 bundle_PA,bundle_MAT,bundle_TA,bundle_TB
PB 依赖 bundle_PB,bundle_MAT,bundle_TB
在游戏中实例PA,PB后,销毁PA,然后调用UnloadUnusedAssets,会让bundle_TA,bundle_PA卸载,bundle_MAT由于有PB引用,未卸载
再次实例PA之后,会重新加载bundle_TA,bundle_PA,而bundle_MAT在内存中不用重新加载,这个之后,就算重新加载了bundle_TA,但是bundle_MAT对bundle_TA的依赖关系却不能恢复,导致从bundle_MAT获取的MA的贴图TA丢失,
如果有一个资源下载失败,就会一直存在DownloadSystem的_downloaderDic中,不能被remove。
存在这样一个调用链:
YooAssetsDriver.Update() -> YooAssets.Update() -> DownloadSystem.Update()
由于YooAssetsDriver.Update()频繁调用,就会导致DownloadSystem.Update()一直调用,下载失败的资源会一直存在于_downloaderDic中(下载成功才remove),就会无限重复下载,然后一直失败。
资源下载失败次数,超过重试的次数时,是不是在DownloadSystem的_downloaderDic把他remove掉?
版本:1.3.7
UniqueBundleName勾选后,关闭窗口再打开,勾选状态没了。
帮忙看看资源版本号能不能改成Int64
昨天升级到1.4.7,打了新的资源包,然后部署到cdn。
旧应用YooAsset的版本是1.4.6-preview,旧应用更新到 新版的资源(YooAsset1.4.7打出来的资源),然后在加载AssetBundle时候就报错了(旧版的YooAsset1.4.6-preview,无法加载新版本YooAsset1.4.7打出来的资源包的吗?YooAsset1.4.7可以加载旧版YooAsset1.4.6-preview的打包资源吗?每次升级YooAsset,会不会导致旧版用不了?)
The AssetBundle '__data.bundle' could not be loaded because it references scripts that are not compatible with the currently loaded ones. Rebuild the AssetBundle to fix this error.
还有一个小问题,1.4.7没有上自定义日志的功能吗?新手用YooAsset对它不熟,测试反馈了问题不好跟,没有日志有点难查。。
AssetBundleFileLoader 有一段这样的代码
// 1. 从服务器下载
if (_steps == ESteps.Download)
{
int failedTryAgain = int.MaxValue;
_downloader = DownloadSystem.BeginDownload(MainBundleInfo, failedTryAgain);
_steps = ESteps.CheckDownload;
}
int failedTryAgain = int.MaxValue;
如果文件一直下载失败,就会一直重试
可不可以使用CreatePatchDownloader 时传进去的failedTryAgain这个参数?
未有加載好下一個主場景已釋放目前主場景的資源
作者您好,最近一直在拜读YooAsset,因此特意开一个issue希望能和您交流下源代码。烦请您不要关闭这个issue,以后我的问题将都合并在这个issue,也希望您不吝赐教。
目前我的思路主要还是在整理整个框架的运行思路,目前已经有了些眉目。关于异步加载的部分是在YooAssetDriver中的Update函数中进行驱动的,也就是说在Unity的每一次update中会进行资源的更新,同时我看到在loader和provior中的update函数中会执行一个完整的加载流程不会中断。那这样的话会不会导致在某几个update中因为加载资源占用时间过多而导致卡帧的现象呢?
在一些文章中会说希望将异步加载放在协程中进行,但我自己尝试过在协程中加载资源,其实也是和您updatge中差不多的流程,一套加载完这种,所以协程异步加载资源应该是怎么样构建呢,或者说怎么样设置异步加载的时间将其分摊在不同的update中呢?
因为我目前还是在学习的状态,并未参加过上线项目的开发,也想这个问题想和您探讨下关于资源异步加载的时间分配问题,希望您不吝赐教。祝好!
版本:1.3.4
构建时命名规则选择了EOutputNameStyle.HashName
构建出来的文件是没有后缀名的
IQueryServices的QueryStreamingAssets方法接受到的文件名是带有.bundle后缀的,且加载失败后自动请求下载的远程链接文件名也是带.bundle后缀的
1.0.1 package.json里面版本号没加上去🤔
Space Shooter里由于引用了UniFramework、BetterStreamingAssets,查看YooAsset不够直观。
建议制作一个只用YooAsset就可以跑通YooAsset主流程的demo。这个demo展示全部YooAsset的核心功能,也可以有一些比较高级的用法,例如自定义过滤、自定义加密/解密等等。demo不一定要是一个可运行的游戏,演示功能才是重点。
如果有这样一个demo,学习成本会进一步降低,上手越快,用户增长也会越快。
我的项目中使用了YarnSpinner(一个用于实现对话的库), 它有两种格式的资源文件: .yarn和.yarnproject.
现在的问题是我想在YooAsset 的Collector 中收集这两种格式的文件, 但打包失败了
我翻了一下YooAsset的源码, 发现EditorDefine.cs中的EAssetFileExtension没有支持这两种文件格式
public enum EAssetFileExtension
{
prefab,
unity,
fbx,
anim,
controller,
png,
jpg,
mat,
shader,
ttf,
cs,
}
所以我的想法是能不能通过YooAssetSetting, 让用户自定义支持的AssetExtension
unity 2021_1 以下版本会出现
具体代码位置
YooAsset.Editor.TaskPrepare #19行
#if !UNITY_2021_1_OR_NEWER
if (buildParameters.BuildPipeline == EBuildPipeline.BuiltinBuildPipeline)
throw new Exception($"Unity2021 or newer not support {nameof(EBuildPipeline.BuiltinBuildPipeline)}, Please use {nameof(EBuildPipeline.ScriptableBuildPipeline)}");
#endif
详细看了下,个人观点,仅供参考。
这个插件有的功能Addressable都有,Addressable有的功能它还没有,比如事件调试器;
API也没有Addressable简单,比如Addressable1个API可以实现它3个API的功能。
对async和UniTask的支持也不好,Addressable自身支持async,而UniTask又自身支持Addressable,这个项目是自身支持UniTask,有点食物链上下游的感觉。
YooAsset很棒,体验很好,为了兼容现有产品,看了YooAsset代码,编辑器模式下更新文件是存放在sandbox里,非编译器模式下存放在电脑的Appdata目录里,如何将这部分的路径改为StreamingAssets里,目前看代码是写死的,没有对应的封装。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.