Coder Social home page Coder Social logo

Comments (25)

shandongsu avatar shandongsu commented on June 14, 2024

Unity的编译参数设置HOTFIX_ENABLE

from xlua.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

打开哪些宏?只打开着一个宏代码报错

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

HOTFIX_ENABLE就应该不会报错了,你报啥错?

from xlua.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

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.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

你要拷贝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.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

还有个问题是这块代码需要触发,如果我想更新在线游戏的代码怎么来触发lua文件来覆盖。

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

http://gad.qq.com/article/detail/7182056

from xlua.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

这个方法看过,可能所有可能出错的类里都要做这个判断了

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

晕,就程序启动的时侯有一个地方判断是否有hotfix,有就加载一下。
在加载的文件中指名替换哪些函数就可以了。C#那是感觉不到的

from xlua.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

if (File.Exists("/path/to/hotfix.lua"))
{
LuaEnv luaenv = new LuaEnv();
luaenv.DoString(File.ReadAllText("/path/to/hotfix.lua"));
}我说的是这个方法需要在可能出错的类里面都要写,没错啊

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

不是可能出现错误的类,只要整个进程有一个地方就可以了。

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

不是某个类加载的文件就只是修复本类。你看下HotfixTest2那个例子

from xlua.

jiadeZhang avatar jiadeZhang commented on June 14, 2024

参考命令(可能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.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

NGUI的类需要自己手动导进工程么,大神

from xlua.

FlaminiQian avatar FlaminiQian commented on June 14, 2024

这个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.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

我的这个示例能运行成功的

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

@FlaminiQian 你执行下xLua/Generate Code

from xlua.

hwust avatar hwust commented on June 14, 2024

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.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

@hwust 是最新的代码么?还是下载的预览版?

from xlua.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

@chexiongsheng xlua可以把NGUI导进lua么,没找到相关示例

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

@ZhuOliver ,xLua针对的是C#语言本身,只要是C#语言写的,就一样的处理方式。不可能把世界上所有库都给个示例。

from xlua.

hwust avatar hwust commented on June 14, 2024

@chexiongsheng OK 刚刚更新代码了。 已经能正常显示hotfix inject finish! 多谢

from xlua.

ZhuOliver avatar ZhuOliver commented on June 14, 2024

image是按照这个文档操作么

from xlua.

chexiongsheng avatar chexiongsheng commented on June 14, 2024

@ZhuOliver 不是。。。你怎么总把事情想得那么复杂!
看看《XLua教程》,看下C#代码怎么换成用lua来写。
你在C#里头用NGUI需要神马“导入”么?直接函数调用,new对象之类就ok了,这些C#代码都可以换成lua代码。

from xlua.

FlaminiQian avatar FlaminiQian commented on June 14, 2024

@chexiongsheng 可以了,多谢

from xlua.

Related Issues (20)

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.