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 import GreeterClient class ?

YasiWonb opened this issue · comments

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

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>

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

You can close this issue now if it works.