How do I connect Unity to a server backend developed in .net core?

I'm currently running to a wall in my game development and I need now some discussion to clear my mind... In my mind I have a plan for some little online game (focused around clicking and idling), which I imagined could be served both on website and winapp, and in future even in mobile platforms.

I have chosen C# for it, build some server backend (join server, game server), but 'cause I want this server components be runned on linux, I have chosen .net core. Which is now my problem, because I'm building the game client in Unity, which only works in .net standard.

My main problem now is that I have build some "base network library" for communication, written in .netcore with plenty of NuGet packages, which I now have implement to Unity to get it work, but there are now conflicts (the main one is that unity is using another version of System.Threading).

Now I am wondering what steps should I choose nexts... There are some work behind now (but not so much, there are only some basic proceses for login and creating game worlds), so probably make that base network package compatible with .netstandard and .netcore.

Or I am thinking if it isn't more suitable to choose some another technology like c++ and some 2D engine in it (which to choose?).

What are you opinions? And what would you do in this situation?

• If you use a protocol based on raw TCP or UDP sockets, then it should be possible to implement client and server in completely different technologies. But you won't be able to do a WebGL build. There are no raw sockets in the web browser. Only WebSockets, which work differently and won't be understood by a server which doesn't implement the websocket protocol. Jun 29, 2020 at 9:59
• Well, I created some network library with client and server, message protocol... With usage of DI from NuGet, .netcore JSON... DI isn't the main problem in the end... But probably I will need better structure than JSON, which is a problem for implementing in unity, or at least for usage of System.Text.Json library, with is colliding with .netstandard Threading lib. And of course, this library is now compiled with .netcore. Jun 29, 2020 at 10:05
• So my first step could be compile that network library for .netcore and .netstandard, and maybe get rid of JSON in message body and make it somehow better... I'm thinking about creating some message protocol for uniting the communication, but not sure how to make it properly. If I get this message protocol out of my "network library" I can build something for the unity project. Jun 29, 2020 at 10:16
• Unity has an own JSON implementation. Jun 29, 2020 at 10:21

• If this solves your problem, could you mark your answer as Accepted? Unless you are still waiting for a new answer. Jul 30, 2020 at 8:32