Skip to content

2021.3.3f1 非编辑器下运行报错 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kojima648 opened this issue Aug 9, 2022 · 4 comments
Closed

2021.3.3f1 非编辑器下运行报错 #7

Kojima648 opened this issue Aug 9, 2022 · 4 comments

Comments

@Kojima648
Copy link

Kojima648 commented Aug 9, 2022

图片

如图,AB包已经打过了,StreamingAssets中也有资源。但是运行报错,资源复制到了PHPStudy那个目录下了已经。

@GREAT1217
Copy link
Owner

GREAT1217 commented Aug 9, 2022

错误日志上说了,GameHotfixEntry.OnLoadAOTDllSuccess() 中出现的错误。

AOT dlls 有问题,打包工程,会生成在 Game/Hotfix 文件夹中,然后再打 ab 包测试。

HybridCLR Builder 中 Build 模块写了步骤的。

具体的原理,建议先看一遍 HybridCLR 的官方文档。

https://focus-creative-games.github.io/hybridclr/performance/generic_limit/

@Kojima648
Copy link
Author

我的流程和操作都正常,在2020.3可以,换了2021,就报错。下面的invoke就进不去,你还是检查下吧,编辑器必现
图片

@GREAT1217
Copy link
Owner

GREAT1217 commented Aug 10, 2022

定位到问题了。把 GameHotfixEntry.Start() 函数中宏定义 UNITY_EDITOR 取反,也会出现相同的错误。

是编辑器下加载元数据的问题。原因是:

编译代码时,会根据编译平台剔除平台以外的代码。

所以在编辑器运行时执行 Game.Hotfix.dll 的逻辑时,会忽略宏定义 UNITY_EDITOR 中的逻辑,加载元数据而出现错误。

目前解决办法是:编辑器下加载 Game.Hotfix 程序集测试热更逻辑,编译的 GameHotfix.dll 只能打包后测试。(已提交更新)

感谢你的反馈~ 😊

你也可以使用别的办法跳过 <编辑器下加载元数据> 这个错误,以在编辑器下测试 Game.Hotfix.dll。

@GREAT1217 GREAT1217 pinned this issue Aug 10, 2022
@Kojima648
Copy link
Author

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants