Unity3D + ulua simpleframework的问题汇总
2016-02-14 14:30
519 查看
使用最新版本的(此时最新)的ulua, 生成wrapper文件时,对范型支持支持不是很好,如:
{System.Collections.Generic.List`1[System.String]&} 的type类型,会生成出System.Collections.Generic.List`1[System.String]到c#中,导致编译不通过。
经过代码review, 发现ToLuaExport文件中的GetStrType,对上面的类型判断IsGenericType返回false, 不确定是否是什么原因(&)引起的,
所以在else中修改成如下代码,就可以生成List<String>
{System.Collections.Generic.List`1[System.String]&} 的type类型,会生成出System.Collections.Generic.List`1[System.String]到c#中,导致编译不通过。
经过代码review, 发现ToLuaExport文件中的GetStrType,对上面的类型判断IsGenericType返回false, 不确定是否是什么原因(&)引起的,
所以在else中修改成如下代码,就可以生成List<String>
else if(t.IsGenericType) { return GetGenericName(t); } else { // modified by cpeng for il2cpp // referenced to BindLua::GetGenericName <span style="font-family: Menlo;"> Debug.Log("IsGenericType not work for " + t.ToString());</span> // t.IsGenericType for {System.Collections.Generic.List`1[System.String]&} somehow return false, we handle it here. if (t.GetGenericArguments().Length != 0) { Type[] gArgs = t.GetGenericArguments(); string typeName = t.Name; string pureTypeName = typeName.Substring(0, typeName.IndexOf('`')); return pureTypeName + "<" + string.Join(",", GetGenericName(gArgs)) + ">"; } return _C(t.ToString()); }
相关文章推荐
- unity3d 调用windows窗口
- [置顶] unity中NavMesh组件及使用介绍
- unity3d纹理格式设置
- unity3d Gizmos 画圆
- Unity插件_____DoTween(二)
- unity游戏数据的几种形式
- Unity Android 不显示阴影
- 构建ASP.NET MVC5+EF6+EasyUI 1.4.3+Unity4.x注入的后台管理系统(55)-工作流设计-表单布局
- [基础知识] 总结使用Unity 3D优化游戏运行性能的经验
- Unity打造简易的GalGame游戏剧本编辑引擎
- unity3d 在2D空间中让一个点注视另一个点
- unity
- unity awake start 的区别
- SQL Server 2016 Community Technology Preview 3.3
- unity初探之黑暗之光(2)
- Unity 摄像机
- Unity-Animator深入系列---StateMachineBehaviour初始化时间测试
- Unity-官方教程:我如何制作一个天空盒?
- unity基于ugui高级控件库 uLui
- Unity-Manual:Skybox