xasset / xasset Goto Github PK
View Code? Open in Web Editor NEW提升你的生产力。
Home Page: https://xasset.cc
License: Other
提升你的生产力。
Home Page: https://xasset.cc
License: Other
作者您好,我在使用过程中需要加载一个用multiple模式切分的sprite,得到一个包含切分好的sprite的array。但是这个功能框架里好像没有提供。xasset好像只用到了LoadAsset和LoadAssetAsync这两个函数,没有提供对LoadAssetWithSubAssets的支持,如果要加上这个功能的话应该放在哪里呢?
UnityWebRequest 和 WWW 机制不同
UNITY_2018_3_OR_NEWER开启情况下功能不生效,请知悉
例如文档和视频链接,麻烦有时间处理一下 或者 有其他链接吗?
阅读代码发现,下载成功用的都是下标记录位置,假设同时下载3个文件.由于index2的文件比较小,马上下载完成了,此时选择挂起restart()
可能会出现0 和1 没下载,但是restart后,下标指向错误把.这里只是猜测.
NullReferenceException: A null value was found where an object instance was required.
UnityLoader.js:4 at Plugins.XAsset.Bundles.Load (System.String assetBundleName, Boolean isLoadingAssetBundleManifest, Boolean asyncMode) [0x00000] in :0
UnityLoader.js:4 at Plugins.XAsset.Bundles.Initialize (System.String path, System.String platform, System.Action onSuccess, System.Action1 onError) [0x00000] in <filename unknown>:0 UnityLoader.js:4 at Plugins.XAsset.Assets.Initialize (System.Action onSuccess, System.Action
1 onError) [0x00000] in :0
UnityLoader.js:4 at AssetsInit.Start () [0x00000] in :0
UnityLoader.js:4
UnityLoader.js:4 (Filename: currently not available on il2cpp Line: -1)
问题代码:
xasset/Assets/Plugins/XAsset/Download.cs
Line 127 in 7f9b9e5
应改为:
request.SetRequestHeader("Range", "bytes=" + len + "-" + (maxlen - 1));
或者干脆改为:
request.SetRequestHeader("Range", "bytes=" + len + "-");
详细参考:
https://www.cnblogs.com/OIMM/p/9144798.html
多说两句:
我觉得这个maxlen的真正意义是为了分段下载,避免一次下载内容长度过长,导致内存占用过高。希望作者可以重新梳理下逻辑。
首次下载cdn versions.json文件时 没有与本地时间戳进行对比 会直接生效cdn下载的json文件
示例项目中有四个assetbundle name,分别是sprites、prefabs、scenes、textures,编译ab后,其中sprites对应的资源是Logo.png和Grids.png,但是选中这两个图片,右下角assetbundle name显示为none,点击右下角的remove unused names,也没有移除上面4个abname,请问这4个abname对应的资源,是在哪里设置的?
我在场景A实例化了一个Cube,但是切换到场景B,再切换到场景A,预设物的地址就会报错
// 加载 prefab
var path = "Assets/Prefabs/Cube.prefab";
var request = Asset.LoadAsync(path, typeof(GameObject));
yield return request;
var prefab = request.asset;
var go = Object.Instantiate(prefab);
// 回收 prefab,在回收前,需要先把 实例化的 go 销毁。
//Object.DestroyImmediate(go);
request.Release();
使用开源版的时候我不会对xasset代码框架做任何调整,单纯使用
初始包只有第一个场景,会热更新新, 玩家打过第一个场景就下载第二个场景, 第二个场景有更新的话也会热更新, 这个怎么做啊
作者你好,
咨询一个问题
我有一个组TextureGroup,当我需要增量其中Texture 1时,是否需要增量整个TextureGroup完成更新呢?
Xasset是否支持类似Addressables的Check for Content Update Restrictions(检查内容更新限制)功能,只对修改的文件做增量更新?
用回 UnityEngine.SceneManagement.SceneManager.LoadScene 就没问题
如题
如果有比较多的build的话,会出现versions_v1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.json这种奇怪的文件,建议调整下版本号的策略。因为我的项目中有几十个build,也不知道是什么原因,直接导致在用jenkins打包时,unity直接到后面就shutdown了~
我目前的做法是:
1)动态计算bundle data目录下的versions_vX.json的版本号;
2)bundle data不存在version_vX.json时使用versions_v1.json;
3)存在时,如果versions文件内的data部分和bundle cache中的一致则不更新版本文件依旧使用该版本;
4)如果不一致,则取最大版本号版本信息文件versions_vX.json的X+1作为新的版本号。
这样就不会出现这种奇怪的文件。
Updater.cs
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
return "iOS"; // OSX
改为
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
return "OSX"; // OSX
打Android包在手机上测试,发现热更总是失败,打debug包发现,在创建WebRequest直接就异常了,捕捉到的异常信息也为null,很是奇怪
private WebRequest GetHttpWebRequest()
{
var request = (HttpWebRequest) WebRequest.Create(info.url)
}
有考虑支持asset bundle 热更新吗?
这开源的还跟之前的一样bug多吗?
在例子文档中看到了这个接口:
// 查询 assetContainer.GetAssets() 返回的资源是否需要下载更新。
var getDownloadSizeAsync = Assets.GetDownloadSizeAsync(versions, assetContainer.GetAssets());
这个接口在代码中没有找到,请问这个是付费版的功能吗?assetContainer是主要用来做什么的?
之前的版本里有个根据清单获取更新大小的接口,新版本里貌似被取消了。
比分说我有100个关卡,每次进关卡之前都要看下资源是不是有更新。我目前是做了100个Build,类似于之前的清单文件。
每次进关卡之前,使用GetDownloadSizeAsync检查下这个build是不是有更新。
public static GetDownloadSizeRequest GetDownloadSizeAsync(string buildName)
{
var versions = ScriptableObject.CreateInstance<Versions>();
versions.data = Versions.data.Where(version => buildName.Equals(version.name)).ToList();
return GetDownloadSizeAsync(versions);
}
如题!
Assets.SimulationMode = Settings.GetDefaultSettings().simulationMode;
Assets.OfflineMode = Settings.GetDefaultSettings().offlineMode;
if (Assets.SimulationMode)
{
InitializeRequest.CreateHandler = EditorInitializeHandler.CreateInstance;
AssetRequest.CreateHandler = EditorAssetHandler.CreateInstance;
SceneRequest.CreateHandler = EditorSceneHandler.CreateInstance;
References.GetFunc = Settings.GetDependencies;
References.Enabled = true;
}
这里使用了Settings里读取的SimulationMode导致无法使用代码来设置
既然提供了初始化为什么这个里还需要放到AfterSceneLoad?
无论手机还是unity中,切换后台或者息屏OnApplicationFocus被调用,暂停恢复游戏后出现无法恢复下载,
观察代码隐约感觉有bug,如下:
public void Restart()
{
_startTime = Time.realtimeSinceStartup;
_lastTime = 0;
_started = true;
_downloadIndex = _finishedIndex;
var max = Math.Min(_downloads.Count, maxDownloads);
for (var i = _finishedIndex; i < max; i++)// 当已经下载数量超过 max ,这个for无法执行,_tostart add就为空.(猜测)
{
var item = _downloads[i];
_tostart.Add(item);
_downloadIndex++;
}
}
该工具不支持场景打包吗?
对包含有光照贴图或者navmesh数据的场景打包会报错
Cannot mark assets and scenes in one AssetBundle
作者你好!
项目UGUI使用了新版的 sprite atlas, 一个 UI 模块对应了一个 sprite atlas, 用一个 全局的SpriteAtlasLoader.cs负责 atlas 的加载;
根据官方文档的介绍, 要实现 late binding,得使用SpriteAtlasManager.atlasRequested; 但是并不知道这个 sprite atlas Asset 什么时候使用完毕, 那应该什么时候调用 Asset.Release呢?
如题
在项目的文件夹下面Bundles/iOS/ 下面没有生成updateinfo.json 这个文件呀 BundlesCache/iOS目录下存在更新信息和版本json文件
现在versions.json 的生效在DownloadAsync()中 如果在bundles下载前使用到bundle中资源将会自动从cdn中下载
需要提供接口 可以在bundles下载完成后再生效新版资源
var asset = Assets.Load("Assets\\xx\\Resources\\UI/fui.bytes", typeof(UnityEngine.Object));
asset.completed += delegate (Asset a) {};
路径必须这么写才能成功加载。而我希望是这样统一,比如
var asset = Assets.Load("Assets/xx/Resources/UI/fui.bytes", typeof(UnityEngine.Object));
asset.completed += delegate (Asset a) {};
或者
var asset = Assets.Load("Assets\\xx\\Resources\\UI\\fui.bytes", typeof(UnityEngine.Object));
asset.completed += delegate (Asset a) {};
RuntimeAssetHandler 的 Dispose 释放函数是不是应该加上 _loadAssetAsync = null? 因为如果 Request 重用 再次调用 WaitForCompletion 时候判断不通过导致不会进入 LoadAssetAsync 函数
(https://user-images.githubusercontent.com/41471675/207810392-ce80149b-9518-448b-a828-985400325f89.png)
查了下源码,现在也没有能够切换到开发模式,不打assetbundle的方法
我想用 AsyncOperation.allowSceneActivation 去控制scene的加载过场, 但是如果用xasset 的Assets.LoadSceneAsync 会返回 assetrequest,那应该怎么转成 AsyncOperation呢?
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.