Unity中使用gRPC

时间20180508,使用的unity版本2017.2,unity中的.net 4.6平台还是不稳定版本。

示例代码地址:https://github.com/hiramtan/HigRPC_unity

估计还不会有人用在商业手游项目中,原因:

  • .net 4.6还是实验性版本,并不能保证稳定性。
  • 编译可用的gRPC类库到移动平台。
  • 需要验证在Android iOS平台上所有逻辑的稳定性。

在编辑器中使用流程如下:

How to use in unity

  • 设置 .net 4.6

  • 导入 gRPC dll

    • Google.Protobuf.dll
    • Grpc.Core.dll
    • grpc_csharp_ext.x64.dll
    • System.Interactive.Async.dll
  • 创建测试逻辑.

Extention

用户自定义协议及代码生成

Grpc.Tools.1.11.x\tools\windows_x86\protoc.exe -I../../protos --csharp_out Greeter --grpc_out Greeter ../../protos/helloworld.proto --plugin=protoc-gen-grpc=packages/Grpc.Tools.1.11.x/tools/windows_x86/grpc_csharp_plugin.exe

Note: Haven't test on mobile platform

点击链接加入QQ群【83596104】:https://jq.qq.com/?_wv=1027&k=5l6rZEr

猜你喜欢

转载自my.oschina.net/u/2287125/blog/1809588