獲取Google.Protobuf.dll文件,有兩中方式可以獲取,如下:
第一種方法:
獲取官方的Google.Protobuf源碼:
protobuf各個版本下載地址
https://github.com/protocolbuffers/protobuf/tags
解壓之后
這時我們要打開Google.Protobuf這個工程,從這里進入,
本人是用VS2019,進行操作的,這里要對VS2019版的要進行安裝以下的東東
打開工程
點擊生成即可,然后會在Google.Protobuf中的Debug文件夾中生成Google.Protobuf.dll,System.Buffers.dll,System.Memory.dll,System.Runtime.CompilerServices.Unsafe.dll四個dll文件,這四個就是我們需要的,將這四個生成好的dll文件導入到unity中,即可
第二種方法:
用VS2019新建項目,選【類庫】
利用VS的NuGet包管理器來生成Google.Protobuf
生成出來的這幾個文件
packages\Google.Protobuf.3.17.0\lib\net45\Google.Protobuf.dll
packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll
packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll
packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\ System.Runtime.CompilerServices.Unsafe.dll
這就生成出來了四個dll文件,Google.Protobuf.dll,System.Buffers.dll,System.Memory.dll,System.Runtime.CompilerServices.Unsafe.dll