【问题标题】:Google.Protobuf.Reflection is not working with il2cpp scripting in UnityGoogle.Protobuf.Reflection 不适用于 Unity 中的 il2cpp 脚本
【发布时间】:2020-09-22 02:38:47
【问题描述】:

我正在使用 amazon gamelift 在 unity3d 中创建一个 android 游戏。
我正在使用实时服务器客户端 sdk。当我运行该应用程序时,它会在我的 gamelift 队列中创建一个游戏会话,但在我使用 IL2CPP 服务器脚本时无法发送消息。
当我使用 Mono 时它工作正常,但在切换到 IL2CPP 后我面临很多问题修复,我找到了许多错误的解决方案,但无法找到此特定错误的解决方案。似乎 Google.Protbuff.Reflection 不适用于 IL2CPP。错误显示它无法找到方法 ClearMessage,即使它存在。
谁能帮帮我..

   Exception occurred sending data. Exception: The type initializer for 'Com.Gamelift.Rt.Proto.PacketReflection' threw an exception.
<br>
System.ArgumentException: Invalid embedded descriptor for "proto/Packet.proto". 
<br>
<b>Stacktrace:</b><br>
Google.Protobuf.Reflection.DescriptorValidationException: com.gamelift.rt.proto.Packet.message: Method ClearMessage not found in Com.Gamelift.Rt.Proto.Packet<br>
      at Google.Protobuf.Reflection.OneofDescriptor.CreateAccessor (System.String clrName) [0x00000] in <00000000000000000000000000000000>:0 <br>
      at Google.Protobuf.Reflection.OneofDescriptor..ctor (Google.Protobuf.Reflection.OneofDescriptorProto proto, Google.Protobuf.Reflection.FileDescriptor file, Google.Protobuf.Reflection.MessageDescriptor parent, System.Int32 index, System.String clrName) [0x00000] in <00000000000000000000000000000000>:0 <br>
      at Google.Protobuf.Reflection.MessageDescriptor+<>c__DisplayClass4_0.<.ctor>b__0 (Google.Protobuf.Reflection.OneofDescriptorProto oneof, System.Int32 index) [0x00000] in <00000000000000000000000000

【问题讨论】:

    标签: c# unity3d il2cpp amazon-gamelift


    【解决方案1】:

    只通过反射访问的代码被剥离,因为 IL2CPP 不知道它是需要的,并且通过带有内容的 link.xml 解决了(DataModelBindings 是我所有 protoc 生成代码的 .NET 库)

    <linker> <assembly fullname="DataModelBindings" preserve="all"/> </linker>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-03
      • 1970-01-01
      • 2021-04-18
      • 2020-05-09
      • 1970-01-01
      • 1970-01-01
      • 2022-08-19
      • 1970-01-01
      相关资源
      最近更新 更多