GithubHelp home page GithubHelp logo

tuyoogame / yooasset Goto Github PK

View Code? Open in Web Editor NEW
2.2K 2.2K 441.0 33.25 MB

unity3d resources management system

Home Page: https://www.yooasset.com/

License: Apache License 2.0

C# 99.64% ShaderLab 0.13% HLSL 0.23%

yooasset's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yooasset's Issues

有个使用问题想请教一下,在联机运行模式下,YooAsset已经初始化了,一段时间后,服务器有一个新的DefaultHostServer返回,如何将新的DefaultHostServer更新到YooAsset?

在联机运行模式下,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

请问这种情况要怎么处理?

typo: Operaiton => Operation

	/// <summary>
	/// 开启一个异步操作
	/// </summary>
	/// <param name="operation">异步操作对象</param>
	public static void StartOperaiton(GameAsyncOperation operation)
	{
		OperationSystem.StartOperaiton(operation);
	}

YooAssets.LoadSceneAsync("aaa").ToUniTask() 卡死

如果这个资源压根不存在(无法通过路由索引到"aaa"这个场景时),UniTask一直处于挂起状态,而合理的预期应该是处于Fail状态。
原因是由于
AssetSystem.cs 140行左右的代码:在判断assetInfo.IsInvalid之后生成了一个CompletedProvider,但是并没有将其加入到Update队列中,导致这个玩意的State一直是None,从而卡死UniTask。UniTask必须得是IsDone才会往下走呀

关于图集打包问题

图集A打包成一个assetbundle,设置成MainAssetCollector,后续需要代码动态加载。
预制体B引用图集A的spriteC,打包成一个assetbundle,设置成MainAssetCollector。
发现spriteC被抽出来单独打成一个。
用assetStudio查看shareAssetBundle,看起来就只有sprite本身信息,没有texture。

表现:
editor上走assetbundle是正常的。

[Bug]升级到1.4.4后报错

**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.List1[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后正常

reporter 下面的include assets会显示不全

查看报告时如果assetbundle较多,会挤占大部分空间,导致includeassets显示不全
版本:unity2021.3.4 yooassets:1.4.4preview

image

解决办法:
可以考虑修改flex属性,上下listview都改为50%
E%{5}8BO_53VFU C}SVR@YT

Unity2019.3.2.f1导入报错

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在资源卸载方面有自动管理的模块吗?或者有什么好的一些解决方案?而不是说通过工具去查泄露找问题来修改。

原生资源加载接口还是有问题,demo也无法正常加载。

	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)

如果工程里没有 shader 的话,构建会报异常。

如果工程里没有 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

在UnloadUnusedAssets的时候,未考虑bundle间的依赖,导致被依赖的bundle unload之后,重新load回来,bundle中资源依赖关系丢失,导致显示问题

一个简单的例子
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中,然后就会一直下载,一直失败。

如果有一个资源下载失败,就会一直存在DownloadSystem的_downloaderDic中,不能被remove。

存在这样一个调用链:
YooAssetsDriver.Update() -> YooAssets.Update() -> DownloadSystem.Update()

由于YooAssetsDriver.Update()频繁调用,就会导致DownloadSystem.Update()一直调用,下载失败的资源会一直存在于_downloaderDic中(下载成功才remove),就会无限重复下载,然后一直失败。

资源下载失败次数,超过重试的次数时,是不是在DownloadSystem的_downloaderDic把他remove掉?

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,打了新的资源包,然后部署到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 文件下载失败无限重试

AssetBundleFileLoader 有一段这样的代码

// 1. 从服务器下载
if (_steps == ESteps.Download)
{
	int failedTryAgain = int.MaxValue;
	_downloader = DownloadSystem.BeginDownload(MainBundleInfo, failedTryAgain);
	_steps = ESteps.CheckDownload;
}

int failedTryAgain = int.MaxValue;
如果文件一直下载失败,就会一直重试

可不可以使用CreatePatchDownloader 时传进去的failedTryAgain这个参数?

下面几个类也有类似的实现
02CD52996CBDED61CEDF03A302434F26

多个scene打在一个ab包时,卸载子场景抛异常。

如果两个场景打在一个bundle里,以叠加模式加载了一个子场景,子场景卸载的时候,由于主场景引用还在,就会跳过bundle卸载,接着就会引发上面我发的那个异常。
简单来说就是把samples里面场景的Collector的Pack规则设置为PackCollector,然后卸载子场景,就会抛异常。
0{%K9XJLD@KXG ( 3H15JQ
N)$(X22CC6XZ0}_MOTG631G

关于YooAsset的源代码相关的问题

作者您好,最近一直在拜读YooAsset,因此特意开一个issue希望能和您交流下源代码。烦请您不要关闭这个issue,以后我的问题将都合并在这个issue,也希望您不吝赐教。

目前我的思路主要还是在整理整个框架的运行思路,目前已经有了些眉目。关于异步加载的部分是在YooAssetDriver中的Update函数中进行驱动的,也就是说在Unity的每一次update中会进行资源的更新,同时我看到在loader和provior中的update函数中会执行一个完整的加载流程不会中断。那这样的话会不会导致在某几个update中因为加载资源占用时间过多而导致卡帧的现象呢?

在一些文章中会说希望将异步加载放在协程中进行,但我自己尝试过在协程中加载资源,其实也是和您updatge中差不多的流程,一套加载完这种,所以协程异步加载资源应该是怎么样构建呢,或者说怎么样设置异步加载的时间将其分摊在不同的update中呢?

因为我目前还是在学习的状态,并未参加过上线项目的开发,也想这个问题想和您探讨下关于资源异步加载的时间分配问题,希望您不吝赐教。祝好!

构建时选择内置所有文件 但是在Android上加载文件失败

版本:1.3.4
构建时命名规则选择了EOutputNameStyle.HashName
构建出来的文件是没有后缀名的

IQueryServices的QueryStreamingAssets方法接受到的文件名是带有.bundle后缀的,且加载失败后自动请求下载的远程链接文件名也是带.bundle后缀的

阅读文档后遇到的理解上的一些问题

  1. 启用Addressable时,文件名字相同怎么办?

  2. 用不同的构建管线的根本区别是什么?在使用上有区别吗?
    image

  3. 下面两个名字间有什么联系?
    image
    image

  4. YooAsset的变体设置的作用是?

  5. 开启加密后,资源有可能被破解吗?破解难度如何?

提个关于新人上手的小建议

Space Shooter里由于引用了UniFramework、BetterStreamingAssets,查看YooAsset不够直观。

建议制作一个只用YooAsset就可以跑通YooAsset主流程的demo。这个demo展示全部YooAsset的核心功能,也可以有一些比较高级的用法,例如自定义过滤、自定义加密/解密等等。demo不一定要是一个可运行的游戏,演示功能才是重点。

如果有这样一个demo,学习成本会进一步降低,上手越快,用户增长也会越快。

支持非unity的原生格式

问题描述

我的项目中使用了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

跟Addressable相比没有什么优势

详细看了下,个人观点,仅供参考。
这个插件有的功能Addressable都有,Addressable有的功能它还没有,比如事件调试器;
API也没有Addressable简单,比如Addressable1个API可以实现它3个API的功能。
对async和UniTask的支持也不好,Addressable自身支持async,而UniTask又自身支持Addressable,这个项目是自身支持UniTask,有点食物链上下游的感觉。

如何配将热更文件存储路径?

YooAsset很棒,体验很好,为了兼容现有产品,看了YooAsset代码,编辑器模式下更新文件是存放在sandbox里,非编译器模式下存放在电脑的Appdata目录里,如何将这部分的路径改为StreamingAssets里,目前看代码是写死的,没有对应的封装。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.