Lua 问题 持久更新

版权声明:记录上工作中的一些问题 https://blog.csdn.net/m0_37583098/article/details/88761823

问题一:可以正常跑Lua代码,但是编译打包出错   错误信息:

Assets/XLua/Gen/UnityEngineLightWrap.cs(614,59): error CS1061: Type `UnityEngine.Light' does not contain a definition for `lightmapBakeType' and no extension method `lightmapBakeType' of type `UnityEngine.Light' could be found. Are you missing an assembly reference?

解决方法: 将lua下的示例代码ExampleGenConfig.cs 提到Editor下 添加缺失的部分 我这里是UnityEngine.Light下的lightmapBakeType

new List<string>(){"UnityEngine.Light", "lightmapBakeType"},

执行菜单xlua ->Clear Generator code ,再执行xlua ->Generator code 

截图:

原理:

 想在lua中调用C#的代码,一般要生成相应的wrap文件,xlua通过打标签的方式来进行实现。

官方建议不要在类里面打标签,该方式方便,但在il2cpp下会增加不少的代码量,不建议使用。

而是统一到一个文件里,提供了示例代码ExampleGenConfig.cs,统一写在一个文件里。

猜你喜欢

转载自blog.csdn.net/m0_37583098/article/details/88761823