Cysharp / YetAnotherHttpHandler

YetAnotherHttpHandler brings the power of HTTP/2 (and gRPC) to Unity and .NET Standard.
MIT License
376 stars 33 forks source link

How to import GreeterClient class ? #15

Closed YasiWonb closed 1 year ago

YasiWonb commented 1 year ago

Hello, I have a dummy question.

In "Using gRPC (grpc-dotnet) library" section of README , how can I use compiled GreeterClient class into Unity project ? var greeter = new GreeterClient(channel);

I suppose GreeterClient class has been compiled following [Microsoft gRPC tutorial] (https://learn.microsoft.com/en-us/aspnet/core/tutorials/grpc/grpc-start?view=aspnetcore-7.0&tabs=visual-studio) , ie in external project.

Or should I generate class from .proto file directky into Unity ?

Many thanks

RubenGarcia commented 1 year ago

Generate from proto file using

Packages/Grpc.Tools.<version>/tools/windows_x64/protoc --grpc_out=<dir> --csharp_out=<dir> --plugin=protoc-gen-grpc=Packages/Grpc.Tools.<version>/tools/windows_x64/grpc_csharp_plugin.exe <proto file>
YasiWonb commented 1 year ago

Hi @RubenGarcia , I was able to download protoc.exe and grpc_csharp_plugin.exe from NuGet package at "https://www.nuget.org/packages/Grpc.Tools/" (not sure this is correct and if I need to put them under Packages folder of Unity project)

However I cannot figure out what should be grpc_out and csharp_out regarding Unity project folders. If I have a classical "Assets/Scripts" structure, can I set "Assets/Scripts" for both grpc_out & csharp_out ?

Many thanks

=== Update === It seems to work with grpc_out and csharp_out set to "Assets/Scripts", but I had to add https://www.nuget.org/packages/Google.Protobuf/ into Assets/Plugins

RubenGarcia commented 1 year ago

You can close this issue now if it works.

YasiWonb commented 1 year ago

Thanks to @RubenGarcia