lua-protobuf 新手入门篇-第二章.Unity & lua-protobuf 环境配置

本文详细介绍了如何在Unity环境中配置Lua-Protobuf,实现二进制proto文件的读取功能。通过修改Unity工程中的LuaDLL.cs和LuaEnv.cs文件,以及编写测试用的C#、Lua和Proto代码,演示了完整的配置流程和测试步骤。

第一章.编译lua-protobuf支持库(Windows插件-Win10编译)
第二章.Unity & lua-protobuf 环境配置
第三章.二进制proto读取功能,与,lua-protobuf注意事项简介说明
第四章.编译lua-protobuf支持库(Android插件-Win10编译)
第五章.编译lua-protobuf支持库(Android插件-Mac10.13.6编译)
第六章.编译lua-protobuf支持库(IOS插件-Mac10.13.6编译)
一,Unity配置lua-protobuf支持设置
1,打开自己新建的Unity工程D:\lua_proto\Assets\XLua\Src\LuaDLL.cs文件
大概41行

  public partial class Lua
  {
   
   
#if (UNITY_IPHONE || UNITY_TVOS || UNITY_WEBGL || UNITY_SWITCH) && !UNITY_EDITOR
        const string LUADLL = "__Internal";
#else
    const string LUADLL = "xlua";
#endif

以上代码下面复子粘贴,以下代码

    //LUA支持PROTOBUF
    [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]
    public static extern int luaopen_protobuf_c(System.IntPtr L);

    [MonoPInvokeCallback(typeof(LuaDLL.lua_CSFunction))]
    public static int LoadProtobufC(System.IntPtr L)
    {
   
   
      return luaopen_protobuf_c(L);
    }

    [DllImport(LUADLL, CallingConvention = CallingConvention.Cdecl)]
    public static extern int luaopen_pb(System.IntPtr L);

    [MonoPInvokeCallback(typeof(LuaDLL.lua_CSFunction))
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

asasj57

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值