xlua官网:https://github.com/Tencent/xLua
安装和必看的文档:
1.c#调用lua:https://www.jianshu.com/p/8dde7be41d96
2.lua调用c#:https://www.jianshu.com/p/aeb52e214329
3.常用标签
[LuaCallCSharp]:
[CSharpCallLua]:
4.导出
XLuaExporter.cs,放在Editor目录下
1 using System; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using XLua; 5 6 public static class XLuaExporter 7 { 8 [LuaCallCSharp] 9 public static List<Type> luaCallCSharpList = new List<Type>() 10 { 11 typeof(HttpManager), 12 }; 13 14 [CSharpCallLua] 15 public static List<Type> cSharpCallLuaList = new List<Type>() 16 { 17 }; 18 19 [BlackList] 20 public static List<List<string>> blackList = new List<List<string>> 21 { 22 }; 23 }
点击菜单栏XLua\Generate Code,生成的代码会放在Assets\XLua\Gen下