![](https://img.haomeiwen.com/i1835687/e8bb8a363c27a6fc.png)
Unity开发中,我们可能需要用到protobuf-net这个C#实现的ProtoBuff库。
但是,protobuf-net在IL2CPP下,因为反射的一个不兼容问题,是会运行崩溃的,导致iOS下没法玩。
这时候需要对protobuf-net稍作修改,重新编译出DLL才能在Unity下完美运行。
![](https://img.haomeiwen.com/i1835687/db3f34bf44c6243f.png)
![](https://img.haomeiwen.com/i1835687/3e678ebc4709cd34.png)
这种修改,估计很多遇到同样问题的项目都遇过了。 分享给遇到同样困难的人,希望有帮助。
详细修改,放到GitHub的一个分支上了。
https://github.com/kingsoft-topgame/protobuf-net/commit/4eddeeb41b4e67e3ed59b11c727c73a12f48589d
网友评论
ProtoBuf.Serializer.Deserialize<conf.TGameAllConf>(ms);
反序列化的时候还是这样写的吗? 貌似一直在报错