Serious issues with Unity's undocumented networking functionality

Hi guys,

For the last two weeks I’ve been struggling with Unity’s frankly god awful networking functionality. Specifically, I’ve been trying to use Unity’s own master server, facilitator and proxy solutions and I’ve discovered that not only is the documentation extremely poorly written, it’s also sparse (e.g. the unity proxy server information found here isn’t even grammatically correct Unity - Scripting API: Network.useProxy ').

Today I had to spend an hour adding proper error logging to the Unity proxy server code as it did not even check to see if it had initialised correctly, and error reporting is basically limited to yes there was an error, or no the function succeeded, which is just terrible. I also wasted the time of a network technician working for our server host because the problem appeared to be a connectivity issue.

I have managed to fight my way through the poor documentation, technical mishaps and strange design of the Unity network but appear to have finally hit a brick wall:

Even with NAT punch through, my clients cannot connect to each other, ever, if they are behind a router. To fix this I setup the Unity proxy server (and ran into the errors described above which I finally fixed) but now, I get a NatTargetNotConnected error from the peer when it tries to connect to the proxified server ip/port. I’ve tried using the default facilitator, and i’ve tried disabling nat entirely to no avail. It looks like the proxified ip is causing the issue, as connecting two machines over our internal network without hitting the proxy works fine. I’ve verified that the proxy is connecting to the same facilitator as the peer and server are, and I see output in the proxy, master server and facilitator logs suggesting that they are communicating.

If anyone could help me with this I’d greatly appreciate it, I’ve just about had enough of Unity’s networking issues and honestly, we’re almost at the point where we might dump Unity altogether, as it just doesn’t seem to be a good solution for multiplayer games.

Did you setup the 3 required servers and update their data in your code?
The 3 things required are:

  • Master Server
  • Connection Tester
  • NAT Facilitator

The connection tester is required because it actually tests if nat punchthrough is required and what type if possible.

Can’t comment on the proxy server as it was a new addition in Unity 3 with zero documentation and I for one wouldn’t touch it at all. If I need a proxy then my solution to the problem is either using Photon Unity Network + Photon Cloud which removes any need for NAT and will work with mobile phone networks too, or if the game requires player hosting and a decentralized architecture, I use my UnityPark suite from http://www.muchdifferent.com which offers a host of additional features and significantly better scalability and functionality.

Unity networking out of my view is fine for starting and prototyping but I wouldn’t dare to touch it for production use as it is not supported in any acceptable way nor implemented in a way that makes it competitive in any form to above solutions.

Thanks for the advice, yes it looks like we won’t be using Unity for networking, or if we do it’ll be with a 3rd party tool. However these have their own problems such as licensing issues and closed source.

I’m quite baffled by this facilitator issue, the IP/port of the facilitator is definitely the same for server, client and proxy, so how can there be a mismatch? I went ahead and let the default facilitator do the work instead and still no dice, same error. The really irritating thing is that the error message doesn’t even tell me how or even which of the peers disagreed.

Could perhaps the developer who wrote the proxy server example give some advice about this? I’m still hoping that there might be a way to fix this issue without debugging pages of c++ code.

[edit]
To clarify, it looks like one of the peers [server, client, proxy] is connected to the wrong facilitator address/port, but the error message I receive in Unity does not tell me what the wrong address/port is, or exactly where things went wrong.