1 Star 3 Fork 4

freedom1263 / CSharpLuaForUnity

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

CSharpLuaForUnity

CSharpLuaForUnity尝试使用CSharp.lua将Unity工程中的C#脚本编译至Lua,以使其可用C#进行高效的开发,但是也能用Lua完成热更新,也已经开始在部分新项目中被采用。

依赖说明

如何使用

  • 在Unity编辑器环境下,会新增菜单项'CSharpLua',子菜单'Compile'可将工程目录Compiled下的C#代码编译成Lua代码放置到Assets/Lua/Compiled目录,子菜单'Switch to XXX'可在运行C#代码还是编译后的Lua代码中切换。设想的是实际开发中一直使用C#代码开发和调试,需要真机发布时,才编译到Lua代码。
  • Examples目录下有一个简易的列子,可直接运行。可以看出能够支持在预设中挂载自定义的C#脚本,在运行Lua代码时,预设会被动态适配处理,具体实现可见代码。因而在打包时也需要对存在挂载了自定义C#脚本的的预设做相同的处理。

项目结构

使用了assembly definition files额外定义了一些程序集工程,依赖顺序如下。

Assembly-CSharp.dll --------> Compiled.dll --------> Bridge.dll --------> Base.dll

  • Compiled 此工程中的代码可编译至Lua,需要热更新的代码放到这个工程中
  • Bridge 可被Compiled引用的代码,需要Wrap到Lua的环境中
  • Base 可被Bridge引用的代码,但是不需要被Compiled所引用到

交流讨论

致谢

相关工程

也可以考虑使用ILRuntime完成类似的需求 https://github.com/Ourpalm/ILRuntime

The MIT License (MIT) Copyright (c) 2015 topameng Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

CSharp.lua的Unity适配,可将Unity工程中的C#代码编译至Lua 展开 收起
C#
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C#
1
https://gitee.com/freedom1263/CSharpLuaForUnity.git
git@gitee.com:freedom1263/CSharpLuaForUnity.git
freedom1263
CSharpLuaForUnity
CSharpLuaForUnity
master

搜索帮助