Unity G RPC Sample by nikaera - 1

Games & ProjectsCamera

A system to synchronize camera position and rotation in Unity and Go

Unknown VersionUnknown LicenseUpdated 1 year agoCreated on June 2nd, 2019
Go to source


A system to synchronize camera position and rotation in Unity and Go on Mac




Go 1.12.5


Unity 2018.3.14f1


Install protoc command with gRPC plugin using homebrew.

brew install protobuf
brew tap grpc/grpc
brew install grpc
go get -u -v github.com/golang/protobuf/protoc-gen-go

Move to Unity_gRPC_Sample/golang_server/nikaera.com/gRPC_sample/world/ with terminal, and generate grpc related files for go and unity csharp.

# For Go gRPC files
protoc -I . --go_out=plugins=grpc:. room.proto user.proto

# For Unity gRPC files
protoc -I ./ --csharp_out=./ --grpc_out=./ --plugin=protoc-gen-grpc=/usr/local/bin/grpc_csharp_plugin room.proto user.proto

Copy Unity_gRPC_Sample/golang_server/nikaera.com to $GOPATH.

cp -r Unity_gRPC_Sample/golang_server/nikaera.com $GOPATH

Copy Unity gRPC files to script folder in project.

cp Room.cs User.cs RoomGrpc.cs Unity_gRPC_Sample/unity_client/gRPC_sample/Assets/Scripts/gRPC

Unity gRPC Plugin

  1. Download the gRPC build from the https://packages.grpc.io/.
  2. Click the link that exists in the item of Build ID. (ex. 9f70381d-a50b-44b5-87cf-62e43d72037e)
  3. Click the grpc_unity_package.x.xx.x-dev.zip link of C# to download zip file of gRPC library.
  4. Extracting the downloaded zip file will create a Plugin folder. Move Plugin folder to Unity_gRPC_Sample/unity_client/gRPC_sample/Assets.


  1. Move to Unity_gRPC_Sample/golang_server/nikaera.com/ with terminal, and start gRPC server as follows.
go run server/main.go
  1. Open the Unity_gRPC_Sample/unity_client/gRPC_sample folder several times with Unity.
  2. Run each Unity project with the gRPC server running.
  3. The position or rotation of the Main Camera is moved, the status is reflected in the objects of other Unity projects
  4. Rewriting the source code as you like, Have fun!
Show all projects by nikaera