Comments (25)
Unity的编译参数设置HOTFIX_ENABLE
from xlua.
打开哪些宏?只打开着一个宏代码报错
from xlua.
HOTFIX_ENABLE就应该不会报错了,你报啥错?
from xlua.
Assets/XLua/Src/Editor/Hotfix.cs(15,12): error CS0234: The type or namespace name Cecil' does not exist in the namespace
Mono'. Are you missing an assembly reference?
from xlua.
你要拷贝cecil库进工程
https://github.com/Tencent/xLua/blob/master/Assets/XLua/Doc/hotfix.md
热更特性依赖Cecil,添加HOTFIX_ENABLE宏之后,可能会报找不到Cecil。这时你需要到Unity安装目录下找到Mono.Cecil.dll,拷贝到项目里头。而HOTFIX_DEBUG_SYMBOLS则依赖Mono.Cecil.Pdb.dll,Mono.Cecil.Mdb.dll。
参考命令(可能Unity版本不同会略有不同,把别的Unity版本带的拷贝过来试了也能用,比如有的老版本Unity是不带Mono.Cecil.Pdb.dll,Mono.Cecil.Mdb.dll的,这时可以把新版本带的整套拷贝过来):
OSX命令行 cp /Applications/Unity/Unity.app/Contents/Managed/Mono.Cecil.* Project/Assets/XLua/Src/Editor/
Win命令行 copy UnityPath\Editor\Data\Managed\Mono.Cecil.* Project\Assets\XLua\Src\Editor
不支持静态构造函数。
from xlua.
还有个问题是这块代码需要触发,如果我想更新在线游戏的代码怎么来触发lua文件来覆盖。
from xlua.
http://gad.qq.com/article/detail/7182056
from xlua.
这个方法看过,可能所有可能出错的类里都要做这个判断了
from xlua.
晕,就程序启动的时侯有一个地方判断是否有hotfix,有就加载一下。
在加载的文件中指名替换哪些函数就可以了。C#那是感觉不到的
from xlua.
if (File.Exists("/path/to/hotfix.lua"))
{
LuaEnv luaenv = new LuaEnv();
luaenv.DoString(File.ReadAllText("/path/to/hotfix.lua"));
}我说的是这个方法需要在可能出错的类里面都要写,没错啊
from xlua.
不是可能出现错误的类,只要整个进程有一个地方就可以了。
from xlua.
不是某个类加载的文件就只是修复本类。你看下HotfixTest2那个例子
from xlua.
参考命令(可能Unity版本不同会略有不同,把别的Unity版本带的拷贝过来试了也能用,比如有的老版本Unity是不带Mono.Cecil.Pdb.dll,Mono.Cecil.Mdb.dll的,这时可以把新版本带的整套拷贝过来):
Win命令行 copy UnityPath\Editor\Data\Managed\Mono.Cecil.* Project\Assets\XLua\Src\Editor\
我按这个拷贝了文件为什么没有打印hotfix inject finish! 一直xlua.access, no field __Hitfix0_Update。
from xlua.
NGUI的类需要自己手动导进工程么,大神
from xlua.
这个sample编译时会报下面这个warning
can not find delegate for HotfixTest..ctor! try re-genertate code.
UnityEngine.Debug:LogWarning(Object)
XLua.Hotfix:InjectMethod(AssemblyDefinition, MethodDefinition, Int32, FieldReference) (at Assets/XLua/Src/Editor/Hotfix.cs:314)
XLua.Hotfix:HotfixInject() (at Assets/XLua/Src/Editor/Hotfix.cs:250)
从而导致hotfix inject finish!不会被打印,从而点击按钮时会报xlua.access, no field __Hitfix0_Update的错误,是不是因为我是下载zip包的关系。。
from xlua.
我的这个示例能运行成功的
from xlua.
@FlaminiQian 你执行下xLua/Generate Code
from xlua.
UNITY5.4.3 中
can not find delegate for GenericClass`1..ctor! try re-genertate code.
UnityEngine.Debug:LogWarning(Object)
XLua.Hotfix:InjectMethod(AssemblyDefinition, MethodDefinition, Int32, FieldReference) (at Assets/XLua/Src/Editor/Hotfix.cs:235)
XLua.Hotfix:HotfixInject() (at Assets/XLua/Src/Editor/Hotfix.cs:171)
已拷贝DLL,已执行 xLua/Generate Code 还是无法收到打印hotfix inject finish!
导致运行时,收到xlua.access, no field __Hitfix0_Update的错误日志。
from xlua.
@hwust 是最新的代码么?还是下载的预览版?
from xlua.
@chexiongsheng xlua可以把NGUI导进lua么,没找到相关示例
from xlua.
@ZhuOliver ,xLua针对的是C#语言本身,只要是C#语言写的,就一样的处理方式。不可能把世界上所有库都给个示例。
from xlua.
@chexiongsheng OK 刚刚更新代码了。 已经能正常显示hotfix inject finish! 多谢
from xlua.
from xlua.
@ZhuOliver 不是。。。你怎么总把事情想得那么复杂!
看看《XLua教程》,看下C#代码怎么换成用lua来写。
你在C#里头用NGUI需要神马“导入”么?直接函数调用,new对象之类就ok了,这些C#代码都可以换成lua代码。
from xlua.
@chexiongsheng 可以了,多谢
from xlua.
Related Issues (20)
- [Hotfix] 有时需要放到非Editor目录才生效
- 内存泄漏严重 HOT 3
- Disabling Domain Reload causes crashes and strange behaviour
- Unity2022.3.16 IOS 打包 报错
- 最新版本支持多asmdef功能revert? HOT 1
- iOS编译报错 duplicate symbol '_luaopen_bit'
- "SymbolsNotMatchingException" occurs when performing Obfuscator after HotFix Injection.
- 想编译Nintendo Switch平台用的XLua版本 HOT 1
- 鸿蒙平台导出包报错 HOT 2
- ps4平台编译xlua不通过 HOT 1
- 添加HOTFIX_ENABLE宏,在主线程中调用GC.WaitForPendingFinalizers导致死锁,有什么推荐修改方案吗? HOT 4
- 代码里using了UnityEngine.Purchasing.Security命名空间导致Android打包inject失败
- self.gameObject无法访问 HOT 2
- xLua适配 OpenHarmony 平台吗 HOT 1
- Unity2022.3.17发布WebGL后运行报错 HOT 1
- 使用ExampleConfig.cs中的热更新Delegate配置,会使C#方法通过反射调用
- webgl平台下如何自定义异步加载loader HOT 2
- webgl微信小程序打包出现错误,求帮助 HOT 1
- 集成第三方库,在webgl平台要怎么处理? HOT 1
- Xlua中非UnityObject对象销毁问题
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 xlua.