asqbtcupid / unreal.lua

lua solution for UnrealEngine4
MIT License
300 stars 98 forks source link

lua执行结果PC和手机上不一致 #28

Closed gamebili closed 6 years ago

gamebili commented 6 years ago

建议把Inherit函数里面的_WITH_EDITOR去掉,统一这个逻辑。实测手机上有时会找不到函数。

asqbtcupid commented 6 years ago

能给个测试用例吗?这是在editor里,为了hotupdate正确而做的继承方式

gamebili commented 6 years ago

我记得是手机上UI的Destroy函数调用不到,查过去发现真的没这个函数,最后定位到这个地方,时间过了很久了我也记不大清楚细节,不过打包到手机运行一些逻辑应该很容易看到问题。

gamebili commented 6 years ago

我看了一下,addfunc函数里有这么一段逻辑if type(v) == "function" and k ~= "Ctor" and k ~= "Destroy" and not des_t[k] then,但是editor模式下,也就是大部分lua程序员的开发时间,setmetatable这个分支并没有做Ctor和Destroy函数的判断,如果lua程序员调用了Destroy函数就会出问题。会不会是这个问题?

asqbtcupid commented 6 years ago

不过我模拟面向对象这里设计的是,不能直接调用Destroy的,而是去调用Release函数,这样会自动从子类的Destroy开始调用,直到父类的Destroy