How to build a protobuf. proto
kane9527-e opened this issue · comments
kane 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?
MonoLogueChi commented
I have a solution using the package protobuf-unity, It is also very simple to use.
- Download Grpc.Tools and change it to zip, unzip it, and use it later.
- Download Google.Protobuf and change to zip, unzip, extract the .dll file and put it under Plugins, just like other plugins.
- Install the plugin protobuf-unity, as in the documentation
- 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.
- 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
Pavel Novikov commented
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.