Adds NAT punch-through and automatic port forwarding to any peer-to-peer networking API
Reduces latency and saves you money by connecting players directly whenever possible, even behind a router.
You only need three methods: StartHostAll(), listMatches(), and StartClientAll() to connect.
Falls back to Unity’s relay servers only if punch-through fails, so players can always connect.
Works on Windows, Linux, and OSX
Asset | Docs | API | FAQ | Demo
Direct connect whenever possible
Why waste your hard earned money using bandwidth on the relay servers if you don’t have to? A direct connection means less lag and less dependence on infrastructure that you don’t control.
Seamless connection replacing
Your players will always use the best connection possible, seamlessly switching from relay to direct connections as they become available.
Faster connection
Gets your players in the game faster by not waiting for a UNET match to be created or joined before connecting.
Set client connect port
Includes the ability to set the port that clients connect from. Just in case you need that.
Note: Punch-through requires an externally hosted server to run the included Facilitator on.
Note: Web builds are not supported. Unfortunately the library we use (RakNet) does not work with WebSockets. Sorry!
Demo video
Tutorial
But Why?
The primary motivation for creating this was so that I could be less dependent on Unity’s relay servers. For one, they are bandwidth restricted, and they seem to introduce some pretty high latency. Plus it’s just one more point of failure that us lowly developers have absolutely no control over. This solution should mean that connecting through Unity’s relay servers is almost never necessary.
Requirements
Unity 5.2 or above. Tested in 5.2.0f2, 5.3.0f4, 5.3.4f1, 5.3.5f1, 5.4.0b3, 5.4.0b15, 5.4.0b22, 5.4.1f1, 5.5.0f3, 5.6.0b11, 5.6.2f1, 2017.1.0f3
The Facilitator
There are two versions of the Facilitator packaged with the plugin. One for windows and one for linux. You can also always get the latest versions below:
If you have any questions just let me know. I hang around in the forums all the time. I’m also always available at the support email. I’m actively developing this plugin for use in my own game so I respond to issues / put out fixes quickly.
Thanks!
Also check out our other plugin to smoothly sync transforms and rigidbodies over the network: Smooth Sync