報錯信息
描述:在直接導入Google.Protobuf.dll時會出現(xiàn)以下兩個報錯信息
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里面的版本,所以就會出現(xiàn)unity報錯,但是VS2022內(nèi)不報錯的情況
解決方法
下載Google Protobuf 的開源代碼使用VS2022生成解決方案,再把bin>Debug>net45文件夾內(nèi)容全部一起導入unity即可
下載地址:https://github.com/protocolbuffers/protobuf/releases文章來源:http://www.zghlxwxcb.cn/news/detail-521189.html
問題解決
文章來源地址http://www.zghlxwxcb.cn/news/detail-521189.html
到了這里,關(guān)于Unity導入Goolgle.Protobuf.dll報錯的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!