Skip to content

gRPC/MessagePack/UniRxを使用した、Unityと.NET Coreサーバでリアルタイムで双方向通信を行うミニマムプロジェクト。

License

Notifications You must be signed in to change notification settings

yKimisaki/UnityServiceTemplate

Repository files navigation

UnityServiceTemplate

制作環境

Server: .Net Core 2.0

Client: Unity 2017.4.5LTS(.NET 4.6)

ローカルで動かす

VisualStudio 2017あたりがあるとよいと思います。

ダウンロードしたプロジェクトの、UnityServiceTemplate.ClientをUnityで開きます。

VisualStudioでUnityServiceTemplate.Clientフォルダ下のUnityServiceTemplate.Client.slnを開きます。

VisualStudioが立ち上がったら、UnityServiceTemplate.Serverを実行します。

サーバが起動したら、UnityでSampleシーンを開いて再生します。

「おはよう」「こんにちは」「こんばんわ」を押して動作を確認します。

EC2上で動かす

image

インスタンスは「.NET Core with Amazon Linux 2 LTS Candidate - Version 1.0」が便利です。

セキュリティグループのインバウンドにTCPで50051(ないしは指定したやつ)のポートを開けておきます。

PSCPなりで以下のファイルをインスタンスの/home/ec2-user/に転送します。

  • ビルドしたやつ
    • UnityServiceTemplate.Server.dll
    • UnityServiceTemplate.Server.runtimeconfig.json
  • PC内を漁って持っていく
    • Grpc.Core.dll(v1.12.0, .net standard 1.5)
    • System.Interactive.Async.dll(v3.1.1, .net standard 1.3)
    • MessagePack.dll(v1.7.3.4, .net standard 2.0)
    • libgrpc_csharp_ext.x64.so(v1.12.0)

次にputtyかなんかでインスタンスに入って、シンボリックリンクを貼ります

ln -s /lib64/libdl-2.26.so /home/ec2-user/libdl.so

ここまできたら、たぶん

dotnet ./UnityServiceTemplate.Server.dll

でサーバが起動するでしょう。

クライアント側はSampleScene.csのlocalhostのあたりに、インスタンスのパブリックDNSを入れればつながると思います。


http://www.apache.org/licenses/LICENSE-2.0

Apache License, Version 2.0 のライセンスで配布されている成果物を含んでいます。

About

gRPC/MessagePack/UniRxを使用した、Unityと.NET Coreサーバでリアルタイムで双方向通信を行うミニマムプロジェクト。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages