Cysharp / YetAnotherHttpHandler

YetAnotherHttpHandler brings the power of HTTP/2 (and gRPC) to Unity and .NET Standard.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to build a protobuf. proto

kane9527-e opened this issue · comments

commented

Thank you for opening up! How to build a protobuf. proto file as cs? Can't you use Grpc.Tools in Unity anymore? So Can you provide a complete example project for generating and calling the GRPC protocol?

I have a solution using the package protobuf-unity, It is also very simple to use.

  1. Download Grpc.Tools and change it to zip, unzip it, and use it later.
  2. Download Google.Protobuf and change to zip, unzip, extract the .dll file and put it under Plugins, just like other plugins.
  3. Install the plugin protobuf-unity, as in the documentation
  4. Set the plug-in according to the document, and fill in the binary file decompressed in the first step for the protoc and grpc paths.
  5. If the previous configuration is correct, drag a .proto file into unity, and it will automatically compile and generate two .cs files.

write a demo

If you create both client and server, I'd recommend MagicOnion (https://github.com/Cysharp/MagicOnion) instead of plain gRPC.
It is build over gRPC, optimized for Unity and does not require .proto files - you write your protos as C# code.