Comments (4)
public static IEnumerator SwitchMode(bool offline) { #if !UNITY_EDITOR YooAssets.Destroy(); YooAssets.Initialize(); package = YooAssets.CreateAssetsPackage(yooAssetSettings.DefaultPackage); // 设置该资源包为默认的资源包,可以使用YooAssets相关加载接口加载该资源包内容。 YooAssets.SetDefaultAssetsPackage(package); if (offline) { yield return Instance.InitializeYooAssetOfflinePlayMode(); } else { yield return Instance.InitializeYooAssetHostPlayMode(); } #else throw new NotImplementedException(); #endif }
可以销毁了重新初始化,还可以换 mode, 不过你可能需要回退到一个 patch 界面中干这件事。
感谢回复,如果有接口可以修改HostPlayModeParameters就更好了。还有一个问题,如果想在下载cdn资源的时候,在请求的头部加一些参数(FileDownloader 里面的UnityWebRequest 加一些请求参数),请问可以怎么实现?
from yooasset.
public static IEnumerator SwitchMode(bool offline)
{
#if !UNITY_EDITOR
YooAssets.Destroy();
YooAssets.Initialize();
package = YooAssets.CreateAssetsPackage(yooAssetSettings.DefaultPackage);
// 设置该资源包为默认的资源包,可以使用YooAssets相关加载接口加载该资源包内容。
YooAssets.SetDefaultAssetsPackage(package);
if (offline)
{
yield return Instance.InitializeYooAssetOfflinePlayMode();
}
else
{
yield return Instance.InitializeYooAssetHostPlayMode();
}
#else
throw new NotImplementedException();
#endif
}
可以销毁了重新初始化,还可以换 mode,
不过你可能需要回退到一个 patch 界面中干这件事。
from yooasset.
提交的PR已经合并~~
from yooasset.
动态替换HostURL地址,我感觉不是一个好主意。如果非要这样做的话,可以把package销毁了,然后重新创建一个package并初始化。
from yooasset.
Related Issues (20)
- 2.1.2版本,打包为什么会把link.xml一起打包呢?是有什么用途吗? HOT 4
- ab的依赖信息 对应不上 HOT 7
- 异步加载的过程中转同步 HOT 1
- 怎么在一个文件夹下加载多个文件?
- 扩展分组激活规则的时候,没有信息,逻辑不好写
- yooasset2.1.2版本里,团结引擎不支持SBP 2.x版本导致编译报错
- Yooasset和Unity官方提供的Localization在打包时有冲突
- 2.1.2版本,打开SourceCode工程报错,没有ScriptableBuildPipeline 1.21.22版本。我用的团结引擎1.1.4 HOT 1
- FileResumeRequest 下载,可能报错 416 Range Not Satisfiable
- 一模一样的代码打出来的hash值不一致的问题 HOT 2
- 当异步加载大量原生资源时,由于异步耗时太多导致无法执行后续加入的异步操作 HOT 4
- 关于资源收集太多导致编辑器启动卡顿问题 HOT 1
- 使用LoadSceneMode.Single加载出来的场景不能被卸载 HOT 3
- 2.1.2 版本,WebGL 平台调用 ResourcePackage 的 DestroyPackage 函数抛异常的问题 HOT 1
- 为什么Static收集器不能加Tag?
- 如何遍历下载资源中的所有文件的文件名? HOT 1
- webgl 打包运行报 Failed to load web catalog file HOT 3
- 2.2.1-pre版本OfflinePlayMode模式构建项目后,更新新的包时提示Can not found belong file system HOT 2
- 2.x版本 SceneHandle.UnloadAsync异步过程中,还会触发Complete事件
- unity版本2022.3.21f1编辑器内catalog是空的 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yooasset.