NAT-Traversal-for-UNET Overview An example implementation of NAT Traversal combined with Unity's UNet HLAPI. Attempts to establish direct connections between players using a combination of NAT Punchthrough and automatic port forwarding. Falls back to UNET's relay servers only when absolutely necessary. When initially connecting the first connection to succeed is used, but if a direct connection succeeds after a relay connection is already established the direct connection will replace the relay connection. *Make sure to take a look at the README.* 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 RakNet and Open.NAT dll's are included for windows but you'll have to compiler your own for Mac / Linux Known Issues RakNet doesn't work with web sockets, so no web builds. Needs lots of testing Download NAT Traversal for UNET Other If you are just looking for NAT punch-through without all the other bells and whistles I've got a simpler example here: NATPunchthroughClient I'm putting this out there for anyone to use. I'd really appreciate any feedback / testing that the community can provide. Another set of eyes always helps and I'm really not positive I've got everything set up 100% correctly. If you download the project and can't get it working please report back here and make sure to mention the router models involved. RakNet is a pretty mature library so if something goes wrong it's probably a problem in my code and probably something easily fixed, or you just happen to have one of the few router setups that punchthrough doesn't work on. You are welcome (and encouraged) to submit pull requests to the repo if you find yourself adding to or extending the functionality in useful ways. Thank you!