OpenAvikom / mr-grpc-unity

Use gRPC to send protocol buffer messages from and to Unity
16 stars 5 forks source link

Missing mock project "csharp" #3

Closed HaiKonofanDesu closed 1 year ago

HaiKonofanDesu commented 1 year ago

I currently can't build my App for Arm64 in VS without getting an error. When I use your generated files everything works without problems so I wanted to check how you generated the c# files.

Sadly there is no "csharp" mockup project that I can build to generate my files. Could you please update this/ let me know how to setup one myself?

Xbathy commented 1 year ago

where is the mock project "csharp"?

aleneum commented 1 year ago

Hello @HaiKonofanDesu and @Xbathy,

I don't plan to provide a csharp project since grpc-dotnet works fundamentally different than the provided grpc solution based on the (previously used) approach based on the (C++) grpc core. Proto files can be found in the proto folder while the generated proto files are located at UnityGRPC/Assets/Proto. Those files have been generated with grpc-tools and can be automatically generated with appropriate csproj-settings. In UnityGRPC/Assets/Proto you will find some GRPC service and client definitions you can use as a foundation but as I mentioned earlier, grpc-dotnet works differently and makes way more use of underlying C# magic, hooks, dependency injection etc. I suggest following the documentation. When you set up your project and copy the proto files into your project it should be able to communicate with Unity or the python server/client.

However, if anyone has a minimal working example grpc-dot project, feel free to create PR.

Xbathy commented 1 year ago

do you remember the version of Google.Protobuf? When i use 3.22.1 to build proto files, there will be errors in unity ,I think the version is different, but i don't the version of this project, i want to build custom proto files, thanks. image

aleneum commented 1 year ago

Sorry,

I just realized the documentation actually states:

For Unity, you need to use dotnet and build the mock project csharp. All required dependencies will be installed by dotnet.

Seems like I forgot to add this part when I created the example. I have no machine to test this right now but this csproj was used in the pipeline to create CSharp files and served us well so far:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <Protobuf_NoWarnMissingExpected>true</Protobuf_NoWarnMissingExpected>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Grpc.Tools" Version="2.23.0">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <Protobuf Include="../proto/*.proto" ProtoRoot="../proto" OutputDir="../UnityGRPC/Assets/Proto" CompileOutputs="false" />
  </ItemGroup>
</Project>

Path might be wrong though. I will give it a try in the evening (CET).

Xbathy commented 1 year ago

thanks a lot,the example have help a lot!

aleneum commented 1 year ago

Hello @Xbathy,

unfortunately I cannot work on this repo right now (for the next 20 days) since the available LFS bandwith has been already drained by too many clones/downloads. There is a 1GB quota for the whole OpenAvikom org and this has been surpassed already. As mentioned in the README, cloning the repo ONCE downloads roughly 300MB. Thus, it just takes a couple of cloning operations to hit the wall. I will add the csproj file/project mock when the quota resets. As mentioned on the release page, the code can still be downloaded here.

aleneum commented 1 year ago

Alright, I could add the files via web interface and test it locally. Seems to be the missing piece. Sorry, @HaiKonofanDesu for letting this one slip. Even though there is a considerable version gap since the Unity components are a bit dated, it is still possible to send messages from Python to Unity. I will close this one since the csharp project has been added and can be used to generate csharp files.