YetAnotherHttpHandler icon indicating copy to clipboard operation
YetAnotherHttpHandler copied to clipboard

How to build a protobuf. proto

Open kane9527-e opened this issue 2 years ago • 2 comments

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?

kane9527-e avatar Aug 05 '23 00:08 kane9527-e

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

MonoLogueChi avatar Aug 05 '23 10:08 MonoLogueChi

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.

pspgit avatar Aug 05 '23 10:08 pspgit