# unity-grpc-sample **Repository Path**: jinq0123/unity-grpc-sample ## Basic Information - **Project Name**: unity-grpc-sample - **Description**: Unity Grpc 示例 - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 4 - **Created**: 2018-08-12 - **Last Updated**: 2023-02-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # unity-grpc-sample Unity Grpc 示例 ## 教程 1. 创建一个项目,开启 .NET 4.x ``` Edit->Project Settings->Player->Other Settings ->Configuration->Script Runtime Version->.Net 4.x Equivalent ``` 1. 从 [GRPC Daily Builds](https://packages.grpc.io/) 下载最新的 grpc-protoc_windows_x86-VERSION.zip, grpc_unity_package.VERSION.zip 1. grpc_unity_package.VERSION.zip 解压到 Assets 目录下 1. 从 github grpc 复制 `examples/protos/helloworld.proto` 为 `Assets/protos/helloworld.proto` 1. 创建 Assets/Scripts/Greeter/, 并在该目录下运行 ``` protoc.exe -I../../protos --csharp_out=. ../../protos/helloworld.proto --grpc_out=. --plugin=protoc-gen-grpc=grpc_csharp_plugin.exe ``` + 或者直接运行 `generate.bat` + 需要先从 grpc-protoc_windows_x86-VERSION.zip 解压 `protoc.exe`,`grpc_csharp_plugin.exe` + 会生成 `Helloworld.cs` `HelloworldGrpc.cs` 1. 添加服务器和客户端脚本,挂到MainCamera上 1. 打包安装到手机测试