Unity导入Goolgle.Protobuf.dll报错

报错信息

描述:在直接导入Google.Protobuf.dll时会出现以下两个报错信息
1.Assembly ‘Library/ScriptAssemblies/Assembly-CSharp.dll’ will not be loaded due to errors:
Reference has errors ‘Google.Protobuf’.
2.Assembly ‘Assets/Plugins/Google.Protobuf.dll’ will not be loaded due to errors:
Unable to resolve reference ‘System.Runtime.CompilerServices.Unsafe’. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
在这里插入图片描述

报错原因

Google.Protobuf.dll 里面有的依赖并不是UnityEditor里面的版本,所以就会出现unity报错,但是VS2022内不报错的情况

解决方法

下载Google Protobuf 的开源代码使用VS2022生成解决方案,再把bin>Debug>net45文件夹内容全部一起导入unity即可
下载地址:https://github.com/protocolbuffers/protobuf/releases
在这里插入图片描述

问题解决

在这里插入图片描述文章来源地址https://uudwc.com/A/BrW5X

原文地址:https://blog.csdn.net/wa36d/article/details/127470342

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请联系站长进行投诉反馈,一经查实,立即删除!

h
上一篇 2023年07月25日 16:05
一个月学通Python(二十三):RESTful架构和DRF入门
下一篇 2023年07月25日 16:09